Newtonsoft.Json.Schema icon indicating copy to clipboard operation
Newtonsoft.Json.Schema copied to clipboard

Error when validating URI string

Open arrkaye opened this issue 6 years ago • 1 comments

Hi,

For the below schema:

{ "title": "URL Form", "type": "object", "properties": { "url": { "title": "URL", "type": "string", "format": "uri" } } }

The following JSON does not validate:

{ "url": "https://www.lonza.com/Asset%20Download%20Manager.aspx?mediaid={9A99E464-CC08-45D9-AF14-115F0C6E086A}&mime=application/pdf&contentpage=1"}

Seemingly due to the curly braces. Apart from being a valid URL, and '{' not being an excluded character in the https://tools.ietf.org/html/rfc3986 standard.

Am I doing something wrong here?

arrkaye avatar Apr 04 '18 13:04 arrkaye

You're not url encoding your query string values. Go do a google search for {9A99E464-CC08-45D9-AF14-115F0C6E086A} and see what the url looks like in your browser after searching. You will notice that the brackets are indeed encoded to %7B and %7D respectively.

johnwc avatar Jul 03 '18 15:07 johnwc