Properties can not be defined in @Schema
See original GitHub issue@agiertli asked on Gitter (Jun 24 15:28) following question:
Hi folks,
I am trying to annotate a parameter which holds an uploaded file in my POST request:
The final OpenAPI spec should look like this: https://swagger.io/docs/specification/describing-request-body/file-upload/
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
fileName:
type: string
format: binary
I can’t seem to find a suitable way how to define ‘properties’., when using MicroProfile annotations for OpenAPI. So far, I have this:
public Response processInvoice(
@RequestBody(content = @Content(mediaType = "multipart/form-data", schema = @Schema(type = SchemaType.OBJECT))) MultipartFormDataInput input)
Which generates:
requestBody:
content:
multipart/form-data:
schema:
type: object
So it seems I am on the right track, but not sure how to proceed further…any ideas?
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (17 by maintainers)
Top Results From Across the Web
json - Property has not been defined and the schema does ...
The additionalProperties keyword only considers the properties and patternProperties defined in the immediate subschema where it appears.
Read more >"The property ... is not defined and the definition does ...
The validation schema expects that only properties that are defined in the JSON schema are to be used within a constraint schema. As...
Read more >Schema of a JSON object has no properties defined
The schema for a JSON payload does not have any properties defined. ... However, the actual content of that JSON object is not...
Read more >object — Understanding JSON Schema 2020-12 ...
The properties (key-value pairs) on an object are defined using the properties ... Any properties that do not match either regular expression are...
Read more >Schema validation reference for object types
The schema defines the JSON schema version to be used to validate the input schema. Since custom objects use their own custom schema,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I agree with the above proposal
I think that a fairly simple solution to this (and perhaps one that is not controversial) would be to introduce
properties
to the@Schema
annotation. So for example, an application of the@Schema
annotation might look like this:This would allow the developer to describe any properties at all.