You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I'm having an issue with @ApiImplicitParam in version 3.0.0.
When we define an ApiImplicitParam like so:
@ApiImplicitParam(name = ID_HEADER, paramType = "header", required = true, dataType = "string", defaultValue = ID_HEADER_DEFAULT, value = ID_HEADER_DESC)
the generated JSON does not contain the type or the defaultValue. Inside the console I see Unable to interpret the implicit parameter configuration with dataType: "string", which makes sense, as in OperationImplicitParameterReader L173 an exception is thrown, as "string" is indeed not a valid class. This also occurs when I try a primitive type, like "int"
The Bug is that this behaviour was valid before 3.0.0, so ideally it'd be great if we could add that functionality back. It looks like this functionality was re-added in commit 3cd0f7c, but I'm having trouble building locally to validate
The workaround is to just use dataTypeClass, with value String.class, as this executes OperationImplicitParameterReader L171, circumventing the problem. But ideally, it'd be great if the previously exisiting functionality could be brought back
I had considered creating a quick code contribution to fix this issue, but then I saw you appear to have fixed it in 3cd0f7c. If that doesn't work, I could make a PR updating the modelSpecification() method to allow param.dataType() to allow the values of "string", and all privitive types.
The text was updated successfully, but these errors were encountered:
samuelbchase
changed the title
@ApiImplicitParam does not accept primatives or "string" as valid dataType values
@ApiImplicitParam does not accept primitives or "string" as valid dataType values
Aug 28, 2020
Hi! I'm having an issue with @ApiImplicitParam in version 3.0.0.
When we define an ApiImplicitParam like so:
@ApiImplicitParam(name = ID_HEADER, paramType = "header", required = true, dataType = "string", defaultValue = ID_HEADER_DEFAULT, value = ID_HEADER_DESC)
the generated JSON does not contain the type or the defaultValue. Inside the console I see
Unable to interpret the implicit parameter configuration with dataType: "string"
, which makes sense, as in OperationImplicitParameterReader L173 an exception is thrown, as "string" is indeed not a valid class. This also occurs when I try a primitive type, like "int"The Bug is that this behaviour was valid before 3.0.0, so ideally it'd be great if we could add that functionality back. It looks like this functionality was re-added in commit 3cd0f7c, but I'm having trouble building locally to validate
The workaround is to just use dataTypeClass, with value String.class, as this executes OperationImplicitParameterReader L171, circumventing the problem. But ideally, it'd be great if the previously exisiting functionality could be brought back
Workaround example:
@ApiImplicitParam(name = ID_HEADER, paramType = "header", required = true, dataTypeClass = String.class, defaultValue = ID_HEADER_DEFAULT, value = ID_HEADER_DESC)
I had considered creating a quick code contribution to fix this issue, but then I saw you appear to have fixed it in 3cd0f7c. If that doesn't work, I could make a PR updating the modelSpecification() method to allow param.dataType() to allow the values of "string", and all privitive types.
Thanks!
Additional Info:
Maven imports:
~/fakepath » mvn clean dependency:tree | grep springfox
[INFO] | +- io.springfox:springfox-swagger2:jar:3.0.0:compile
[INFO] | | +- io.springfox:springfox-spi:jar:3.0.0:compile
[INFO] | | | \- io.springfox:springfox-core:jar:3.0.0:compile
[INFO] | | +- io.springfox:springfox-schema:jar:3.0.0:compile
[INFO] | | +- io.springfox:springfox-swagger-common:jar:3.0.0:compile
[INFO] | | +- io.springfox:springfox-spring-web:jar:3.0.0:compile
[INFO] | | +- io.springfox:springfox-spring-webmvc:jar:3.0.0:compile
[INFO] | | +- io.springfox:springfox-spring-webflux:jar:3.0.0:compile
The text was updated successfully, but these errors were encountered: