Forum Discussion
nmrao
6 years agoChampion Level 3
It would have been helpful if you post the swagger definition, how you have defined the property.
You may want to take a look at the documentation on regular expression for property and see if that is what you are looking for?
https://swagger.io/docs/specification/data-models/data-types/
You may want to take a look at the documentation on regular expression for property and see if that is what you are looking for?
https://swagger.io/docs/specification/data-models/data-types/
- fastdude76 years agoNew Contributor
Hi,
So I assume:ssn: type: string pattern: '^\d{3}-\d{2}-\d{4}$'
this is defining something like what I want, where the type is 'ssn' but it is really just a string.
If I was to have a list of `ssn` could it look like:
["AAA-GG-SSSS","AAA-GG-SSSS","AAA-GG-SSSS"]
ie no wrapping class.
So should this mean that something like:"schema": { "type": "array", "items": { "$ref": "#/definitions/FooId" }
and in definitions
"FooId": { "type": "string", "title": "FooId" },
would work to define an array of FooId where FooId is really just a string type. When the API responds that looks like:
["abcd", "abcd"]
If this is the case then it looks like at least the standard supports. So now I need to find out why springfox is not making those types.
Was this supported in version 2?- fastdude76 years agoNew Contributor
Hi so in the end what I am doing is generating types in the definitions section like so:
FooId : { "type": "string", "title": "CollectionId" }
the swagger API UI seems to be happy with that, and I assume that is legit.
Related Content
- 3 years ago
- 2 years ago
Recent Discussions
- 4 days ago
- 26 days ago