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)
- Error when following exports?
- Dist types now require @types/ts-expose-internals HOT 9
- Fix CJS imports HOT 8
- Invalid index in type HOT 11
- CLI - ENOENT: no such file or directory, open 'package.json' HOT 3
- Error: Unknown type "undefined" HOT 2
- Required types not allowed HOT 1
- Generator crashed when no package version is set HOT 4
- Any way to indicate that a string is actually a date-time? HOT 7
- Breaking changes from v1 to v2 HOT 1
- Support for `"format": "uri-reference"` HOT 3
- Incorrect typing when a type uses Omit and inherits properties from a grandparent interface
- `--expose all` breaks generation with generic types. HOT 4
- How do you use ajv with references? HOT 4
- create schema uses `anyOf` instead of `allOf` HOT 5
- When I use discriminator, I am getting an error where it can't find the specific field HOT 1
- Allow using dependencies schema on certain prop HOT 4
- Undefined reference in ObjectLiteralExpressionNodeParser when using typeof on a spread const HOT 2
- Schema generator fails when nested property name is StringLiteral (kind 11) HOT 4
- error generating schema for keyof typeof x HOT 4
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.