Giter VIP home page Giter VIP logo

Comments (5)

gregsdennis avatar gregsdennis commented on May 9, 2024 1

Offline, @shadow-cs and I discussed and we agree that the best approach would be to add three new interfaces to describe the different types of schema-carrying keywords.

  • single child schema
  • list of schemas
  • string-keyed dictionary of schemas

Keywords will implement these keywords as appropriate. This also provides a mechanism for custom keywords to be included in the kind of navigation that's desired.

from json-everything.

gregsdennis avatar gregsdennis commented on May 9, 2024

I agree with the motivation for this, but I'm struggling to find an elegant solution.

For reference:

I started trying to add a subschemas property to the IRefResolvable interface, but I found that the main problem is that the keywords expose subschemas differently. Some have a single subschema (contains), while others have multiple (anyOf). For the ones with multiple, the subschema is a direct descendant in an array (anyOf), while for others, the schema is nested under keys ($defs, properties), both of which differently affect how references would be resolved.

This means that the "better" solution is actually to create three different interfaces (single schema, multiple indexed subschemas, multiple keyed subschemas) rather than adding onto IRefResolvable, but I'm not sure that really helps navigating the schema structure.

from json-everything.

gregsdennis avatar gregsdennis commented on May 9, 2024

@shadow-cs I'd like to discuss some things about your gist that caught my eye, but such a conversation doesn't suit GitHub well. Do you mind joining my Slack workspace and DM-ing me?

from json-everything.

gregsdennis avatar gregsdennis commented on May 9, 2024

Do you have any issue with these interfaces being implemented explicitly? This means that you'd have to cast to the interface to see the properties. It means that I don't have to rename properties, which would be a breaking change.

from json-everything.

shadow-cs avatar shadow-cs commented on May 9, 2024

Works like a charm, no problems with explicit casting.

from json-everything.

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.