Skip to content

format:Date and zipcode string in response example throws data mismatch error  #420

@jsep925

Description

@jsep925

While parsing one document which have example in responses:

"responses": {
"200": {
"description": "Success",
"schema": {
"$ref": "#/definitions/ApiSuccessResponseAddressLookupResponseType"
},
"examples": {
"application/json": {
"meta": {
"app": "Vertex REST API v0.1.0",
"timeReceived": "2018-02-09T14:08:07.838Z",
"timeElapsed(ms)": 47
},
"data": {
"lookupResults": [
{
"jurisdictions": [
{
"jurisdictionLevel": "STATE",
"jurisdictionId": 31152,
"effectiveDate": "1900-01-01",
"expirationDate": "9999-12-31",
"value": "PENNSYLVANIA"
}
],
"postalAddresses": [
{
"streetAddress1": "2301 Renaissance Blvd Ste 7",
"city": "King Of Prussia",
"mainDivision": "PA",
"subDivision": "Montgomery",
"postalCode": "19406",
"country": "USA"
}
],
"statuses": [
{
"lookupResult": "NORMAL"
}
],
"taxAreaId": 390910000,
"asOfDate": "2017-12-18",
"confidenceIndicator": 100
}
]
}
}
}
}

With definition as following :
"effectiveDate": {
"format": "date",
"description": "The date when the tax for the jurisdiction became effective.",
"type": "string"
},
"postalCode": {
"description": "The postal code used to determine the Tax Area ID ",
"maxLength": 20,
"minLength": 1,
"type": "string"
},

I am getting following error in diagnostics:

Data and type mismatch found. [#/paths/1v11addresslookup/post/responses/200/content/application1json/example/data/lookupResults/0/jurisdictions/0/effectiveDate]
Data and type mismatch found. [#/paths/1v11addresslookup/post/responses/200/content/application
1json/example/data/lookupResults/0/postalAddresses/0/postalCode]

For first error, GetSpecificOpenApiAny(IOpenApiAny openApiAny) in OpenApiAnyConverter didn't convert to type OpenApiDate, all date related string will convert to OpenApiDateTime, so it will marked as Data and type mismatch. Date format should also be supported.

For second error, the example postalCode only contain 5 digits, not full zip, It converted as OpenApiInteger. But since full zip contain 9 digit with "-", so definition as string is valid type, should it not auto convert to integer?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions