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

new ReferenceTypeUtils code fails with IllegalArgumentException with type.getType() is null #4297

Merged
merged 1 commit into from Nov 7, 2022

Conversation

pjfanning
Copy link
Contributor

@pjfanning pjfanning commented Nov 6, 2022

New code in ReferenceTypeUtils causes exception when using swagger-core with Scala Options.

java.lang.IllegalArgumentException: argument "t" is null
	at com.fasterxml.jackson.databind.ObjectMapper._assertNotNull(ObjectMapper.java:4885)
	at com.fasterxml.jackson.databind.ObjectMapper.constructType(ObjectMapper.java:2211)
	at io.swagger.v3.core.util.ReferenceTypeUtils.unwrapReference(ReferenceTypeUtils.java:35)
	at io.swagger.v3.core.converter.ModelConverterContextImpl.resolve(ModelConverterContextImpl.java:79)
	at io.swagger.v3.core.converter.ModelConverterContextImpl.resolve(ModelConverterContextImpl.java:81)
	at io.swagger.v3.core.converter.ModelConverters.readAll(ModelConverters.java:89)
	at io.swagger.v3.core.converter.ModelConverters.readAll(ModelConverters.java:80)
	at com.github.swagger.akka.converter.ModelPropertyParserTest.$anonfun$new$11(ModelPropertyParserTest.scala:163)

@pjfanning pjfanning changed the title new ReferenceTypeUtils code fails with NPE with type.getType() is null new ReferenceTypeUtils code fails with IllegalArgumentException with type.getType() is null Nov 6, 2022
@pjfanning
Copy link
Contributor Author

@frantuma would it be possible to consider adding this null guard? The new ReferenceTypeUtils breaks swagger usage for some Scala use cases.

pjfanning added a commit to swagger-akka-http/swagger-akka-http that referenced this pull request Nov 6, 2022
pjfanning added a commit to swagger-akka-http/swagger-scala-module that referenced this pull request Nov 6, 2022
pjfanning added a commit to swagger-akka-http/swagger-scala3-enum-module that referenced this pull request Nov 6, 2022
@frantuma frantuma merged commit 4d8873c into swagger-api:master Nov 7, 2022
@frantuma
Copy link
Member

frantuma commented Nov 7, 2022

Thanks for spotting it and for the fix!

@pjfanning
Copy link
Contributor Author

pjfanning commented Nov 7, 2022

@frantuma - it turns out this change just leads to a stackoverflow in https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-core/src/main/java/io/swagger/v3/core/converter/ModelConverterContextImpl.java#L81

I'm trying out an alternative change where ReferenceTypeUtils returns null if type.getType is null.

edit: I have added #4299 which seems to work better

@pjfanning pjfanning deleted the patch-4 branch November 7, 2022 18:43
Goblincomet added a commit to Goblincomet/swagger-akka-http that referenced this pull request Sep 25, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants