Giter Club home page Giter Club logo

Comments (3)

jonasschmidt avatar jonasschmidt commented on August 16, 2024 1

Ah ok, that's a library-specific feature not defined in the standard that this library doesn't support. JSON Schema supports ways of bundling multiple schemas as described here though: http://json-schema.org/understanding-json-schema/structuring.html#bundling

from ex_json_schema.

jonasschmidt avatar jonasschmidt commented on August 16, 2024

Hey, if you need help with creating a valid schema with references, there are resources on https://json-schema.org/ that should get you started. The schema you are referencing here is not valid (you can also check with online validators like https://www.jsonschemavalidator.net/ but they won't give you different results).

from ex_json_schema.

Jazcash avatar Jazcash commented on August 16, 2024

I'm working with @Teifion on this, and our use case is that we have a bunch of individual JSONSchemas that describe different request and response endpoints for our API, rather than the entire API being one big JSONSchema file itself. Some of these requests and response schemas share refs to other schemas, but we don't know if it's possible for this library to load schemas with refs to previously loaded schemas.

I'm working on the client side of things using Typescirpt and AJV (JSONSchema validator), and I can supply an array of schemas and it will resolve the refs to other schemas.

const ajv = new Ajv({
    schemas: [
        {
            '$id': 'address',
            type: 'object',
            properties: { line_1: { type: 'string' }, line_2: { type: 'string' } },
            required: [ 'line_1', 'line_2' ]
        },
        {
            '$id': 'person',
            type: 'object',
            properties: { name: { type: 'string' }, address: { '$ref': 'address' } },
            required: [ 'name', 'address' ]
        }
    ]
});

const validator = ajv.getSchema("person");

Is something like this possible for elixir using this lib?

from ex_json_schema.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.