Skip to content

@Currency and swagger documentation #621

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

Closed
raghuraman1 opened this issue Apr 27, 2020 · 6 comments
Closed

@Currency and swagger documentation #621

raghuraman1 opened this issue Apr 27, 2020 · 6 comments

Comments

@raghuraman1
Copy link

Hi @bnasslahsen

Please have a look at this- https://github.com/teq-niq/sample/tree/extending1
I am trying to show using swagger extensions validation constraints that swagger or springdoc might not be showing.
image
As you can see Its generally working well. But I dont see a x-Currency: USD.
Can we solve this? Any suggestions?

Raghu
A valid input will be this
{
"id": 0,
"worth": {
"amount": 99.96,
"currency": "USD"
},
"registrationDate": "20200101",
"firstName": "string",
"lastName": "string",
"email": "[email protected]",
"email1": "[email protected]",
"age": 20,
"creditCardNumber": "4111111111111111"
}

The @Currency check is working well.

@raghuraman1
Copy link
Author

@bnasslahsen Hope its an interesting problem. My guess is its because of the replacement of the MonetaryAmount by the converter - cant see the @Currency since the type having @Currency is replaced

@raghuraman1
Copy link
Author

@bnasslahsen Also see https://github.com/teq-niq/sample/tree/extending3
It avoids creating the converter and uses latest master branch of springdoc.
I am trying to understand if it can be solved.

@raghuraman1
Copy link
Author

False alarm. The annotations are there. I will figure it out.

@raghuraman1
Copy link
Author

Hi @bnasslahsen ,
I was using 1.3.6 version from maven.
Noticed that you have removed
public class SpringDocMonetaryAmountConfiguration {

static {
	SpringDocUtils.getConfig().replaceWithClass(MonetaryAmount.class, org.springdoc.core.converters.MonetaryAmount.class);
}

}
So unless below is called explicitly it causes exception from sample code we get the exception we discussed earlier.
SpringDocUtils.getConfig().replaceWithClass(MonetaryAmount.class, org.springdoc.core.converters.MonetaryAmount.class);

Thought I will let you know. Didnt raise a new ticket.
Raghu

@bnasslahsen
Copy link
Collaborator

@raghuraman1,

In order to give more flexibility to the applications, to choose or not to use it, and aslo to make it easier to support extensions for MonetaryAmount as you mentionned.
Yes thats normal and documented on the F.A.Q:

@raghuraman1
Copy link
Author

raghuraman1 commented Apr 30, 2020

Ok. It broke my examples that I had shared to swagger-core for the extensions. Since then fixed it.
It looks like Francesco Tumanischvili of swagger-core has been inactive for a few days.
Hoping he is doing well.
These are tough times.

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

No branches or pull requests

2 participants