Can I add placeholder or reference to enum list into schema description according to openapi 3.0 specs?

Viewed 216

Schema description needs to be updated with enum list defined in same openapi.yaml file. Here's an example in pseudocode and desirable outcome:

enum:
  - John
  - Doe

description: {enumList} is the name

outcome John Doe is the name

The question is whether some sort of this approach is possible. Schema description supports markdown syntax, but I couldn't find mechanisms that allow to achieve such result

edit: theoretically it can be an array of strings

1 Answers

Neither OpenAPI Specification nor Markdown support templated descriptions out of the box. But you can write a script that would parse an OpenAPI file and substitute your custom templating syntax with the desired values. There are OpenAPI parsers for different programming languages, or you could use a YAML/JSON processor such as yq.

Related