-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OAS extension supporting external documentation references #85
Comments
Can extension fields be added to any part of the schema? Because if so If not, I think Otherwise I really dig this idea. |
If we make the extension purely contextual and remove Maybe the answer is that we use both; we use |
Ok, this seems like a reasonable field then, and I think you already named it when you said what it would be for: |
One thing we should also make clear is when to use this extension, vs. existing features in OpenAPI. In some cases, a |
This can be a linting rule; only allow use of the extension if a non-empty description is provided. |
Add support for including free-form markdown in API documentation.
We want the compiled OpenAPI spec to provide everything needed to generate API documentation. However, we also don't want to have to author this content in a large JSON string with escaped newlines in an actual OpenAPI spec.
Instead, what we want is the ability to reference standalone markdown files, so that they are included in the compiled OpenAPI spec (possibly as large JSON strings), which may then be processed by an API documentation SPA or site generator.
So, I'm proposing an extension,
x-snyk-doc-content
. An example:What these properties mean:
intent
is a hint to the processor of the extension indicating where to put the rendered content. This might be an element#id
, a RapiDoc slot name, or something else.format
indicates how to parse and process the content. Defaults to "markdown" if not specified. Again, this is just a hint to the processor of the extension.$ref
works how you'd expect it to, it's a path or URL containing the content to be included.As an alternative to
$ref:
,contents:
contains the literal documentation contents inline as a string. In YAML, this can be expressed with a multiline string,contents: |-
for example. In JSON, well, it's a large newline-escaped monster of a quoted string.When Vervet localizes an OpenAPI spec, it should replace the
$ref:
properties withcontents:
in this extension. This will require some custom implementation, as the core kin-openapi doesn't do this for us with made-up extensions. However, it is possible -- see the implementation of vervet.IncludeHeaders for an example of resolving custom extension$ref
s.The text was updated successfully, but these errors were encountered: