Skip to content
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

Support to add properties in @Schema #2891

Closed
MarvGilb opened this issue Aug 2, 2018 · 2 comments
Closed

Support to add properties in @Schema #2891

MarvGilb opened this issue Aug 2, 2018 · 2 comments

Comments

@MarvGilb
Copy link

MarvGilb commented Aug 2, 2018

For Maps it should be possible to set known properties to the generated documentation.

e.g.:

@Schema(description = "A map with known and custom properties.")
private Map<String, Object> map = new TreeMap<>();

returns an output like:

map:
  type: object
  additionalProperties:
    type: object
    description: A map with known and custom properties.
  description": A map with known and custom properties.

But required is an output with known properties like this:

map:
  type: object
  properties:
    knownValue1:
      type: string
    knownValue2:
      type: string
  additionalProperties:
    type: object
    description: A map with known and custom properties.
  description": A map with known and custom properties.

Therefore '@Schema' should get an additional variable that allows to override or add properties.

@MarvGilb MarvGilb changed the title Suport to add properties in @Schema Support to add properties in @Schema Aug 2, 2018
@eddsteel
Copy link

eddsteel commented Dec 6, 2018

I have the almost exact opposite problem, of wanting to add custom properties to a schema with fixed fields, i.e. to add additionalProperties to an object with properties already correctly generated.

I think a solution to this would be to allow setting additionalProperties inside @Schema, as well as allowing adding properties there.

@frantuma
Copy link
Member

#4129 introduces support to define Schema properties via annotations. Please see this and this examples for usage scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants