Skip to content

SwaggerIgnore attribute for ignoring specific properties #2085

@korggy

Description

@korggy

I would like to request a [SwaggerIgnore] attribute for ignoring specific properties in the schema.

I found a StackOverflow discussion here, but it's not exactly what I'm looking for:
https://stackoverflow.com/questions/41005730/how-to-configure-swashbuckle-to-ignore-property-on-model

The current approach is to use JsonIgnore, but this also removes the property from serialization. I still want to be serialize the value but remove it from documentation, i.e. in the case that I have an "internal only" property that is used by our own team in special cases but not available to 3rd parties.

The other approach discussed in the StackOverflow post is to write a custom schema filter and register it during startup, but this seems overly complex.

As an alternative, perhaps this could be added as [SwaggerSchema(Ignore = true)] ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions