2

I am trying to use $ref from URL & validating json data using NewtonSoft.Json.Schema.

  1. MainSchema.json

    {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
            "Data": { "$ref": "http://localhost:49735/api/schema/sample" },
        },
        "required": [ "Data" ]
    }
    
  2. SubSchema.json

    {
       "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": 
        {
            "Data": 
            {
                "type": "array",
                "items": 
                [
                    {
                        "type": "array",
                        "items": 
                        [
                            {
                                "id": "id1",
                                "type": "string",
                            },
                            {
                                "id": "id2",
                                "type": "number"
                            }
                        ]
                    }
                ]
            }
        }
    }
    

I have created one sample web api application for downloading subschema as json. URL is reffered in main schema http://localhost:49735/api/Schema/Sample The api is developed with No Authentication Mode. I am using NewtonSoft JSON Schema for validation json data. but while resolving json schema it is throwing exception.

"The remote server returned an error: (401) Unauthorized."
2
  • Try to copy the $ref uri into the browser a test the response with the network tool in the web developer tools. Or use curl. If there is a 401 response, the error is in your server configuration. Commented Jan 19, 2016 at 18:24
  • from browser it works without any issue. seems like it is just because is unable to use n/w proxy Commented Jan 20, 2016 at 10:24

1 Answer 1

0

It may be a proxy issue on your local network. You could try configuring .NET to use your computer's configured proxy - How to authenticate against a proxy when using the HttpClient class?

Sign up to request clarification or add additional context in comments.

1 Comment

It was the issue only. I used proxy & it solved my issue. Thanks James.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.