Comments (6)
We should only use decorators for things that are external/opaque to Concerto. In this case we'd be using these facets to validate string properties so I think the meta model should be extended to support this. 'length' seems like a good name, and we could implement it similar to range for numbers, with an optional lower and upper bound, or we could add 'maxLength' and 'minLength' as explicit meta properties.
from concerto.
The range
property modifier syntax includes an =
so we should mirror that. e.g.
concept Contact {
o String firstName length=[0,100]
}
We could also make lower and upper bounds optional (like with range
), e.g.
concept Contact {
o String firstName length=[1,] // only non-empty strings are allowed
o String lastName length=[,100] // syntactic sugar for [0,100]
}
Also note that with range
, the upper-bound is inclusive, i.e. range=[3,10]
means 3 >= x <= 10
concerto/packages/concerto-core/lib/introspect/numbervalidator.js
Lines 92 to 102 in 9009e82
from concerto.
As discussed on today's working group call, we should give this modifier precedence over the regex modifier if both are used.
Validating against length
is the simpler, faster, and less-general operation.
from concerto.
For translating these field constraints/modifiers into things such as OpenAPI, would using common labels such as those in JSON schema be practical? For example, as @dselman suggested, maxLength
and minLength
to describe character limits in a string, or minimum
maximum
to describe the range of possible values. Also, should distinguishing between inclusive and exclusive range values be considered, such as in the use of exclusiveMinimum
and exclusiveMaximum
?
-Steven
from concerto.
For translating these field constraints/modifiers into things such as OpenAPI, would using common labels such as those in JSON schema be practical?
@f5th-dimensional
Are you suggesting using the same keywords from OpenAPI in Concerto, or just declaring an equivalence when converting to/from OpenAPI.
from concerto.
Please ensure that the latest metamodel is publish to the public model repo: https://models.accordproject.org/concerto/[email protected]
from concerto.
Related Issues (20)
- Vocabularies don't support namespace-scoped decorators HOT 1
- Update runtime classes to understand import aliasing
- Serialization exception when declaring a default false boolean field
- Update concerto-core/serializer to understand aliased imports HOT 2
- Update concerto-core/introspector to understand aliased imports
- Update concerto-analysis rules to analyse aliased imports HOT 3
- Multiple occurence of imported type in importTypes statement
- Redefining an imported type is allowed HOT 4
- Update v4 concerto
- DCS with namespace target, don't apply decorators on top of the namespace. HOT 5
- Update docs about import aliasing usage
- Update concerto-analyser to support import aliasing
- Document / Clarify naming rules for identifiers HOT 4
- concerto-codegen supports import aliasing for Java HOT 1
- Compression for serialized objects HOT 1
- API: getActualImportTypeName() in model Flle in aliasing
- Specialising vocabulary terms for properties HOT 2
- Decorators can reference concepts that are not imported
- Architecture Ideas
- Create a streamlined bundle optimised for Web/AST users
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 concerto.