Azure / Azure/azure-functions-openapi-extension
Question: Is it possible to explicitly define additional schema entities?
- Dominant language
- C#
- Stars
- 388
- Forks
- 202
- PR merge metrics
- No merged PRs in 30d
Description
Apologies if I've missed this in the documentation, but is it possible to explicitly define additional schema entities, either as classes or separately in yaml/json?
I have an issue with one of my nested classes not being automatically generated as a schema entity. I think it is something to do with our naming or the level of nesting, because I can work around it by adding a new property typed to that class in the original class that is used as the type for an `OpenApiResponseWithBody` attribute. The problem with that is obviously that the new property is unnecessary.
For arguments sake the use case might also be that I would like to show some additional schemas in the UI, regardless of whether they are directly used.
Coming from the Node world it is generally possible to add some custom yaml that will always be included in the outputted spec, for example something like the below in an e.g. `entities.yaml` file.
```
ServerErrorResponse:
type: object
properties:
errors:
type: array
items:
type: string
example: "example"
```
Is it possible to use something similar to the `OpenApiExample` attribute, or use yaml/json like above?
Contributor guide
Research direction
Start by tracing the OpenApiExample and OpenApiResponseWithBody attributes mentioned in the issue, then inspect how nested classes become schema entities. The issue names no files or tests; done would require a documented, supported way to include explicitly defined schemas, including unused YAML/JSON schemas, in the generated specification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, openapi
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100