Skip to content

Validation fails for embedded JSON schema #77

@lyubo1

Description

@lyubo1

Hello,

I'm working on building some validation for an Open Service Broker, where the broker API schema is defined using OpenAPI v3.0.0.

It allows for JSON schema to be referenced in the broker api spec itself.

Here is an example:

"schemas": {
    "service_instance": {
    "create": {
        "parameters": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
            "billing-account": {
            "description": "Billing account number used to charge use of shared fake server.",
            "type": "string"
            }
        }
        }
    },

When running the validation, in OpenAPIParser::SchemaValidator#validate_schema,
I see the following error:

   NoMethodError:
       undefined method `any_of' for #

Looking further, the remote reference is properly resolved and the schema draft is fetched as defined in the openapi spec, unfortunately validate_schema doesn't know how to use the schema object to validate the value, especially because the schema is JSON schema.

In validate_schema(schema, value) the passed schema parameter is of type OpenAPIParser::Schemas::OpenAPI and contains the JSON schema draft and value parameter contains the schema definition itself, e.g. schema['service_instaces']['create']['parameters']

I'm using https://github.com/interagent/committee in our specs and looking for suggestions on how to handle this case? Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions