question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support defining "additionalProperties" in @Schema annotation

See original GitHub issue

With #360 support was added for properties, but I can’t find any support for additonalProperties (see https://swagger.io/docs/specification/data-models/dictionaries/). AFAICT it looks like the model does support additional properties (see also #100), but I cannot find anything in the @Schema annotation.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
MikeEdgarcommented, Nov 18, 2020

@flo-ryan , you’re right - I was just spit balling that answer and it turns out not to work (at least in SmallRye). You might try to put a dummy @Path that returns the Map type you require, then use the OASFilter to re-work the output. Obviously this is a hack.

Longer term for the next release (2.1?), perhaps @Schema could be extended with these?

  • Class<?> additionalProperties() default Void.class;
  • boolean additionalPropertiesAllowed() default false;

Any thoughts on this, @EricWittmann, @phillip-kruger, @msmiths ?

1reaction
effywucommented, Nov 30, 2020

Hi guys, we are also in need to have the support of additionalProperties: true in the Schema annotation. Do we have any plan recently for adding this? Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Schema (swagger-annotations 2.1.12 API)
The annotation may be used to define a Schema for a set of elements of the OpenAPI spec, and/or to define additional properties...
Read more >
How to add Properties[] properties in @Schema annotation?
I am not sure how to define the schemas for the Properties in my request parameter schema. Or if a schema is even...
Read more >
Adding additional properties in Swagger - java - Stack Overflow
I am integrating Swagger into my project. I use springfox and open-api 3.0.3. I want to add field additional items for arrays and...
Read more >
Schema in a response allows additional properties
The schema you have defined allows additional properties, ... However, OAS v2 does support using additionalProperties to specify a schema to which the ......
Read more >
jsonschema2pojo
Generate Plain Old Java Objects from JSON or JSON-Schema. ... the boolean value false , then the generated Java type does not support...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found