Define custom formats with ApiModelProperty and ApiParam
See original GitHub issue- What version of the library are you using? 2.8.0
What kind of issue is this?
- Question. Is this a question about how to do a certain thing? - Yes
We are trying to specify format in ApiParam. We see that it supports the field. When swagger is generated, the format field is not present.
@ApiParam(
value = "Example: 12345678-1234-1234-1234-123456789012",
required = true,
allowEmptyValue = false,
format = "testFormat")
@Size(min=36, max=36)
@RequestParam(value = "correlationID") String correlationID)
generates
{
name: "correlationID",
in: "query",
description: "Example: 12345678-1234-1234-1234-123456789012",
required: true,
type: "string",
maximum: 36,
minimum: 36,
}
We also want to add custom formats to ApiModelProperty, but it does not appear to support the format field. Is that a potential feature that can be added, or is there a work-around for this?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Swagger @ApiParam vs @ApiModelProperty - Baeldung
The @ApiParam annotation is for the parameters of an API resource request, whereas @ApiModelProperty is for properties of the model.
Read more >Use @ApiParam or @ApiModelProperty in swagger?
They are both used to add metadata to swagger but they add different metadata. @ApiParam is for parameters. It is usually defined in...
Read more >ApiImplicitParam (swagger-annotations 1.5.12 API)
While ApiParam is bound to a JAX-RS parameter, method or field, this allows you to manually define a ... Adds the ability to...
Read more >Types and Parameters - OpenAPI - Documentation | NestJS
Types and parameters. The SwaggerModule searches for all @Body() , @Query() , and @Param() decorators in route handlers to generate the API document....
Read more >Springfox Reference Documentation - GitHub Pages
Import the bean in your xml configuration by defining a bean of the ... ApiModelProperty#dataType we can override the inferred data types.
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 Free
Top 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
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
How to add below lines in the json file using swagger annotation ? which annotation should be used ?
{ “type”: “string”, “format”: “password” }
I am not able to get proper answer till now…is only by manual way we can achieved this ?