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

Map<String, Instant> return type is missing model #3452

Open
MichaelZett opened this issue Jul 27, 2020 · 4 comments
Open

Map<String, Instant> return type is missing model #3452

MichaelZett opened this issue Jul 27, 2020 · 4 comments

Comments

@MichaelZett
Copy link

After upgrading to Version 3.0.0 (from 2.9.2) a return type of Map<String, Instant> leads to following error message:

"Unable to find a model that matches key ModelKey{qualifiedModelName=ModelName{namespace='java.time', name='Instant'}, viewDiscriminator=null, validationGroupDiscriminators=[], isResponse=true}"

and the model for the return type is not generated but:
"

< * >: {...}
"
@MichaelZett
Copy link
Author

I was able to work around this with:
.alternateTypeRules(
new AlternateTypeRule(
typeResolver.resolve(Map.class, String.class, Instant.class),
typeResolver.resolve(Map.class, String.class, Date.class)
)
)

@dilipkrish dilipkrish added the bug label Jul 29, 2020
@dilipkrish dilipkrish added this to the 3.0.1 milestone Jul 29, 2020
@dilipkrish
Copy link
Member

Thanks for reporting!

@MichaelZett
Copy link
Author

I think return types based on Maps are the problem. Another one I found was Map<String,MonetaryAmount>.
We have a ".directModelSubstitute(MonetaryAmount.class, MoneyNode.class)" for this, that does not work with Map-based return types. Adding
new AlternateTypeRule(
typeResolver.resolve(Map.class, String.class, MonetaryAmount.class),
typeResolver.resolve(Map.class, String.class, MoneyNode.class)
)
like above solves the problem.

@dilipkrish
Copy link
Member

Type substitutions need to be explicit, but let me see if I can address this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants