Comments (5)
The original was designed by @mrix. I am mostly using extended
for my project.
from ts-json-schema-generator.
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.
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.
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.
That makes a lot of sense to me. Thanks for the explanation.
from ts-json-schema-generator.
Related Issues (20)
- Expose parsing of a symbol HOT 1
- Publish NPM release HOT 1
- Imported types are converted into strings in literal expression
- The @discriminator tag does not handle `ref` type discriminators
- TypeError: Invalid value used as weak map key HOT 2
- Missing $id prefix in $ref HOT 4
- Bun.sh support HOT 2
- Type override when compile same type name from different ts file to one json schema HOT 2
- Prevent simplification of UnionType HOT 1
- Add patterns to object property names HOT 1
- Duplicate (nested) discriminator union values not allowed
- Invalid schema generated with circular dependencies - minimal case
- Errors out with mentions of @types/mocha HOT 1
- Function with generic keyof param crashes HOT 2
- Issue Generating JSON Schema for Types with Indexed Access References HOT 1
- Support @required and $data annotations. HOT 5
- Error: Unknown node "Primitive" (ts.SyntaxKind = 162) in specific Type example HOT 8
- Generate a schema with an enum only includes the enums numeric values HOT 4
- Documentation of annotations ? HOT 1
- Enhancement: support polymorphic arrays
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ts-json-schema-generator.