Skip to content

[Bug]: CLI validate Schema error #2198

@JerryNixon

Description

@JerryNixon

What happened?

When using dab validate getting Error: Failed to get schema from url, yet returns okay.

Here's the config file:

{
    "$schema": "https://github.com/Azure/data-api-builder/releases/download/v0.9.7/dab.draft.schema.json",
    "data-source": {
        "database-type": "mssql",
        "connection-string": "<connection-string>"
    },
    "runtime": {
        "rest": {
            "enabled": true,
            "path": "/api",
            "request-body-strict": true
        },
        "host": {
            "mode": "development"
        }
    },
    "entities": {
        "Books": {
            "source": {
                "object": "[dbo].[Actor]",
                "type": "table"
            },
            "rest": {
                "enabled": true,
                "path": "/Actor"
              },
            "permissions": [
                {
                    "role": "anonymous",
                    "actions": [
                        "*"
                    ]
                }
            ]
        }
    }
}

I updated the schema to v0.11.132 using Microsoft.DataApiBuilder 0.11.132+f517dcb8dfe5926d15c24c2ea544dbc3005ee6d1

Same error (updated version): Error: Failed to get schema from url: https://github.com/Azure/data-api-builder/releases/download/v0.11.132/dab.draft.schema.json

The error really makes validate look like it is failing (when maybe it is not?)

Version

Microsoft.DataApiBuilder 0.11.132+f517dcb8dfe5926d15c24c2ea544dbc3005ee6d1

What database are you using?

Azure SQL

What hosting model are you using?

Local (including CLI)

Which API approach are you accessing DAB through?

REST

Relevant log output

PS C:\Temp\dab\today> dab validate
Information: Microsoft.DataApiBuilder 0.11.132+f517dcb8dfe5926d15c24c2ea544dbc3005ee6d1
Information: Config not provided. Trying to get default config based on DAB_ENVIRONMENT...
Information: Environment variable DAB_ENVIRONMENT is (null)
Loading config file from dab-config.json.
Information: Loaded config file: dab-config.json
Error: Failed to get schema from url: https://github.com/Azure/data-api-builder/releases/download/v0.9.7/dab.draft.schema.json
System.InvalidOperationException: Could not find the JSON path of a referenced schema: Manually referenced schemas must be added to the 'Definitions' of a parent schema.
   at NJsonSchema.JsonPathUtilities.GetJsonPaths(Object rootObject, IEnumerable`1 searchedObjects, IContractResolver contractResolver) 
   at NJsonSchema.JsonSchemaReferenceUtilities.UpdateSchemaReferencePaths(Object rootObject, Boolean removeExternalReferences, IContractResolver contractResolver)
   at NJsonSchema.Infrastructure.JsonSchemaSerialization.ToJson(Object obj, SchemaType schemaType, IContractResolver contractResolver, Formatting formatting)
   at NJsonSchema.JsonSchema.ToJson(Formatting formatting)
   at NJsonSchema.JsonSchema.ToJson()
   at Azure.DataApiBuilder.Core.Configurations.JsonConfigSchemaValidator.GetJsonSchema(RuntimeConfig runtimeConfig) in /_/src/Core/Configurations/JsonConfigSchemaValidator.cs:line 74
Information: The config satisfies the schema requirements.
Loading config file from dab-config.json.
Information: [Books] REST path: /api//Actor
Information: Validating entity relationships.
Information: Config is valid.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions