Comments (2)
The type { type: [ 'string', 'integer' ] }
is not valid itself, you can check this by running ts.validateType()
.
Here is the spec quote: it is not allowed to inherit from different kind of primitive types, for example [ number, string ]
from raml-typesystem.
my bad. I was looking to test union types, not multiple inheritance types.
this works:
var ts = require('raml-typesystem').loadType({ type: [ 'string | integer' ] })
var result = ts.validate('string')
// result.isOk() is true
result = ts.validate(1)
// result.isOk() is true
from raml-typesystem.
Related Issues (20)
- Errors inside 'items' show invalid message 'Component type has error: '
- Allowing externals in unions
- Very strange JSON schema validation HOT 1
- Upgrade json-to-ast to a stable release
- An in-range update of rimraf is breaking the build 🚨 HOT 5
- An in-range update of @types/node is breaking the build 🚨 HOT 35
- An in-range update of @types/chai is breaking the build 🚨 HOT 6
- An in-range update of typedoc is breaking the build 🚨 HOT 5
- An in-range update of xml2js is breaking the build 🚨 HOT 1
- An in-range update of underscore is breaking the build 🚨 HOT 3
- An in-range update of @types/underscore is breaking the build 🚨 HOT 1
- An in-range update of @types/node is breaking the build 🚨 HOT 1
- An in-range update of typedoc is breaking the build 🚨 HOT 1
- xmldom-alpha is no longer maintained HOT 1
- Optional dependency raml-xml-validation causes errors
- ITypeDefinition get additionalProperties value HOT 1
- 'Nil' type should be a subtype of `Scalar` as the spec states
- `datetime` validation errors return wrong type name
- FILE_TYPES_SHOULD_BE_AN_ARRAY, thrown for type with example HOT 1
- Can't resolve '../../resources/errorMessages'
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 raml-typesystem.