Skip to content

Is there a way to define fields in the schema should be excluded from docs? (feature flagging fields) #171

@tigerabrodi

Description

@tigerabrodi

What are we trying to achieve?

We're trying to implement feature flagging into our API.

The fields and endpoints should exist (behavior & functionality).

However, if something is feature flagged, it should be excluded from the documentation, whether it'd be fields or an entire endpoint.

We figured out how to exclude entire endpoints, this focuses on excluding fields of an endpoint.

Question

Is there a way to define fields in the schema should be excluded from documentation when generating the docs?

We use OpenAPIRegistry to register what should be documented.

OpenApiGeneratorV31 to generate the docs.

Don't worry about defineRequestSchema in the image below, we do some minor custom stuff.

Is there a way to maybe have skip as one of the options in openapi({ })? Something like skipDocs? Then the field would be excluded from the docs during generation and isn't to be found in the generated openapi.json.

Screenshot 2023-09-12 at 11 01 56

Thoughts

Something else you would propose for dealing with this? 😄

Maybe skipDocs or some similar option could be a new feature.

I'm happy to contribute to the project too! 🙌

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions