Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Validator throws error on valid swagger spec #42

Closed
rahulmishra opened this issue Oct 16, 2014 · 5 comments
Closed

Validator throws error on valid swagger spec #42

rahulmishra opened this issue Oct 16, 2014 · 5 comments

Comments

@rahulmishra
Copy link

I have begun experimenting with swagger and swagger-tools has been an obvious choice but i am a bit confused about some valid JSON schema elements not being honored by the swagger validator.

To take the weather example , I wanted to add a 'pattern' to the 'location' parameter stating it must follow a specific pattern, so i added pattern to the location parameter

"parameters": [
{
"name": "location",
"in": "query",
"description": "The MSN Weather location search string.",
"required": true,
"type": "string",
"pattern":"validPattern"
}
]

Swagger spec says this should be possible, but the swagger tools validator says

/paths//weather/get/parameters/0/pattern: Additional properties not allowed: pattern

Can someone please explain whats going on here because i have seen this happen for other properties as well.

@whitlockjc
Copy link
Member

Can you tell me what version of swagger-tools you're using? I just pushed a release yesterday or the day before that updated the schema.

@whitlockjc
Copy link
Member

If you're using the latest, the only thing I can think of is your pattern is wrong. JSON Schema does validate that the pattern value is a ECMA 262 regular expression pattern. It would be nice to see the pattern.

@rahulmishra
Copy link
Author

I am using 0.5.9

I am pretty sure its not the one which you released yesterday.So, let me look again

@whitlockjc
Copy link
Member

I just tried the latest release, 0.6.5, and this works fine. I took the example in the repository, added the pattern property to one of the parameters and it worked fine. Can you verify that this is no longer an issue when you upgrade your version of swagger-tools?

@whitlockjc
Copy link
Member

If there is no response by end of day, I'm closing this issue as I cannot reproduce it.

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

No branches or pull requests

2 participants