metaschema
metaschema copied to clipboard
Concatenate schemas with fields or other schemas
@lundibundi please edit
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
User { name: 'string' } => User { name: 'string', age: 'number', fullName: 'string' }
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
@lundibundi I think it is better to create another schema rather then mixin into existing one. What do you think?
And how to deal with conflicts if 2 schemas have same field with different type? Error throw?
- create a fork of this repo
- use
npm ci
to install deps - create a branch named
feature/concat-schemas
- create a test for a this feature
Requirements.
- This must be a method
Schema.concat(...schemas )
returns new Schema that contains fields from 2 schemas. - If schemas are conflicting, e.g. they have similar fields with different typings, error must be thrown
- metadata of resulting schema must contatin metadata from both schemas
- if schemas have different KIND - throw error
I'd like to take this one