Open zivkan opened 6 years ago
HTTP and file $refs should be supported...
Please add a sample how you load the schema.
static async Task MainAsync()
{
var schema = await
JsonSchema4.FromUrlAsync(
"http://datafactories.schema.management.azure.com/schemas/2015-09-01/Microsoft.DataFactory.Pipeline.json");
}
This gives me the error:
Unhandled Exception: System.AggregateException: One or more errors occurred. (Could not resolve the JSON path 'http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/UTC' with the full JSON path 'http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/UTC'.) ---> System.InvalidOperationException: Could not resolve the JSON path 'http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/UTC' with the full JSON path 'http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/UTC'. ---> System.InvalidOperationException: Could not resolve the JSON path 'https://schema.management.azure.com/schemas/2015-08-19/Microsoft.Search.json#/resourceDefinitions/searchServices' with the full JSON path 'https://schema.management.azure.com/schemas/2015-08-19/Microsoft.Search.json#/resourceDefinitions/searchServices'. ---> System.InvalidOperationException: Could not resolve the JSON path 'https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression' with the full JSON path 'https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression'. ---> System.InvalidOperationException: Could not resolve the path '#/definitions/SearchServiceProperties'.
at NJsonSchema.JsonReferenceResolver.ResolveDocumentReference(Object rootObject, String jsonPath)
at NJsonSchema.JsonReferenceResolver.
I am also facing this issue while calling the external url from json.
Is there any fix available for this ?
+1
Have the Same Problem:
var schema = JsonSchema4.FromUrlAsync(@"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#").GetAwaiter().GetResult();
Gets:
System.InvalidOperationException: 'Could not resolve the JSON path 'https://schema.management.azure.com/schemas/2017-10-01/Microsoft.Cache.json#/resourceDefinitions/Redis' with the full JSON path 'https://schema.management.azure.com/schemas/2017-10-01/Microsoft.Cache.json#/resourceDefinitions/Redis'.'
@danneberg I've created a PR with some fixes, but the problem is that the URL
https://schema.management.azure.com/schemas/2017-10-01/Microsoft.Cache.json
contains an invalid JSON Schema - there is a "resourceDefinitions" property but only "definitions" is supported...
Maybe the PR fixes the other issues? https://github.com/RSuter/NJsonSchema/pull/761
Was this issue ever resolved? I am having the same problem when trying to create a C# client library using NSwag Studio 13.0.6.0 . I'm trying to load the Strava API.
The Swagger document I'm trying to load is https://developers.strava.com/swagger/swagger.json.
Same error here:
Waiting for PR #1098 to be merged
Hey. Is there maybe some workaround for this issue?
I'd like to load a schema that has $refs to other json files with http urls. Currently NJsonSchema throws exceptions saying it can't resolve those references. Do you have plans to support this scenario?
An example schema is http://datafactories.schema.management.azure.com/schemas/2015-09-01/Microsoft.DataFactory.Pipeline.json. You'll need to download it with a client that doesn't automatically redirect to https or ignore https cert hostname mismatch errors.