Giter Club home page Giter Club logo

Comments (5)

domoritz avatar domoritz commented on July 18, 2024

The original was designed by @mrix. I am mostly using extended for my project.

from ts-json-schema-generator.

sramam avatar sramam commented on July 18, 2024

Extended mode as implemented currently does not render custom annotations.

At the moment, I have a working implementation for extended mode as defined in the issue.

sramam@e4dc559#diff-4385331974c3153a959a41280e91743d

Wondering if there is any appetite for a PR on this?

from ts-json-schema-generator.

domoritz avatar domoritz commented on July 18, 2024

Can you show me a concrete use case for custom annotations? I'm definitely interested in this addition but I also want to be careful not too support as many options as https://github.com/YousefED/typescript-json-schema (I prefer good defaults) because too many options increase the surface area of this tool and make it harder to keep it bug-free as the number of required tests grows exponentially. Having said that, changing how annotations get parsed should only affect a few tests.

from ts-json-schema-generator.

sramam avatar sramam commented on July 18, 2024

As I see it, property attributes are used to communicate information between (sub) systems.

At a base level, type and value/validation attributes suffice. Which is what the JSON schema does.
However, even the spec allows for extensions, http://json-schema.org/latest/json-schema-core.html#rfc.section.6.4.

In my system, I want to keep more information in the annotations. Something as simple as
a default validator + a customized validator. Basically, both have to be satisfied for the
validation to succeed.

The default validator is needed for the underlying system to function. The customized version
is created by the user. The underlying system cannot rely on the customized one being correct
for it's needs. That safety property is a requirement of my system. JSON schema's custom format capabilities make the validation constraints easy to manage.

But for all this to work, I need custom properties to carry the information needed between
subsystems.

Without boring you with details of my system, one way to think of my need is that
an Out-Of-The-Box schema represents the core system. The user can customize it,
as long as the core constraints are satisfied. Since every user can do this, I need
a simple way to provide my users the flexibility while maintaining my sanity.

That last paragraph was a whole bunch of hand-waving, hopefully it makes some sense.
Happy to explain more - but it will have to be off-thread. It's mostly non-proprietary, but
way too much context for this thread.

from ts-json-schema-generator.

domoritz avatar domoritz commented on July 18, 2024

That makes a lot of sense to me. Thanks for the explanation.

from ts-json-schema-generator.

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.