You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As an API vendor / technical writer who uses OpenAPI,
I want to display allowed value ranges in the API reference
to help my users construct successful requests and avoid validation errors.
OpenAPI Specification has keywords to define min/max limits for values:
minimum, maximum, exclusiveMinimum, and exclusiveMaximum for numbers (both integers and floating-point)
Fern's API reference currently does not show these attributes. Whereas most other OpenAPI renderers show them so it's a noticeable gap in Fern's OpenAPI coverage.
Why would it be useful?
Allowed value ranges are essential information in any reference documentation (along with data types, enum values, etc.), so that client developers know which values are valid and which are not.
Describe the solution
API reference displays minimum and maximum values for parameters, request fields, and response fields.
API playground displays minimum and maximum values in the tooltips of parameters and request fields.
Special cases where min/max attributes may need to be displayed a bit differently:
string minLength = maxLength, e.g. a string 5 characters long
array minItems = maxItems, e.g. an array that always contains 2 items
object minProperties = maxProperties, e.g. an object that always contains 2 properties
Additional context
Here're some examples of how other OpenAPI renderers show display min/max values. I personally like Redoc and Swagger UI versions.
Problem description
As an API vendor / technical writer who uses OpenAPI,
I want to display allowed value ranges in the API reference
to help my users construct successful requests and avoid validation errors.
OpenAPI Specification has keywords to define min/max limits for values:
minimum
,maximum
,exclusiveMinimum
, andexclusiveMaximum
for numbers (both integers and floating-point)exclusiveM*
have different value type and behavior in OpenAPI 3.1+ vs OpenAPI <= 3.0minLength
andmaxLength
for stringsminItems
andmaxItems
for arraysminProperties
andmaxProperties
for objectsFern's API reference currently does not show these attributes. Whereas most other OpenAPI renderers show them so it's a noticeable gap in Fern's OpenAPI coverage.
Why would it be useful?
Allowed value ranges are essential information in any reference documentation (along with data types, enum values, etc.), so that client developers know which values are valid and which are not.
Describe the solution
Special cases where min/max attributes may need to be displayed a bit differently:
minLength
=maxLength
, e.g. a string 5 characters longminItems
=maxItems
, e.g. an array that always contains 2 itemsminProperties
=maxProperties
, e.g. an object that always contains 2 propertiesAdditional context
Here're some examples of how other OpenAPI renderers show display min/max values. I personally like Redoc and Swagger UI versions.
Bump.sh
https://bump.sh/preview?url=https%3A%2F%2Fgist.githubusercontent.com%2Fhkosova%2Fdc9ea2c285b61cd36a5ec8eb18b43676%2Fraw%2F7defc7378734e7494d7ec3a2bf0928bc7fe9ff48%2Fmin-max.yaml&commit=Preview
ReadMe
https://preview.readme.io/reference/get_something?url=https%3A%2F%2Fgist.githubusercontent.com%2Fhkosova%2Fb23af6d24f55023f9771bc805b762a18%2Fraw%2Fa5ba6ee45d7f57f4b54c3cb636315bd9ba6cdc97%2Fmin-max.json
Redoc
https://redocly.github.io/redoc/?nocors&url=https://gist.githubusercontent.com/hkosova/dc9ea2c285b61cd36a5ec8eb18b43676/raw/7defc7378734e7494d7ec3a2bf0928bc7fe9ff48/min-max.yaml#tag/Webhooks/paths/moniteWebhook/post
Stoplight Elements
https://elements-demo.stoplight.io/?spec=https://gist.githubusercontent.com/hkosova/dc9ea2c285b61cd36a5ec8eb18b43676/raw/7defc7378734e7494d7ec3a2bf0928bc7fe9ff48/min-max.yaml
Swagger UI
https://petstore.swagger.io/?showCommonExtensions=true&url=https://gist.githubusercontent.com/hkosova/dc9ea2c285b61cd36a5ec8eb18b43676/raw/7defc7378734e7494d7ec3a2bf0928bc7fe9ff48/min-max.yaml#/
Sample OpenAPI spec for testing (note: does not include
min/maxProperties
andexclusiveMinimum/Maximum
).https://gist.githubusercontent.com/hkosova/dc9ea2c285b61cd36a5ec8eb18b43676/raw/7defc7378734e7494d7ec3a2bf0928bc7fe9ff48/min-max.yaml
The text was updated successfully, but these errors were encountered: