Forum Discussion
fastdude7
7 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?
fastdude7
7 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.