metaschema icon indicating copy to clipboard operation
metaschema copied to clipboard

Concatenate schemas with fields or other schemas

Open georgolden opened this issue 2 years ago • 3 comments

@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.

georgolden avatar May 21 '22 09:05 georgolden

@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?

georgolden avatar Jun 10 '22 05:06 georgolden

  1. create a fork of this repo
  2. use npm ci to install deps
  3. create a branch named feature/concat-schemas
  4. 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

georgolden avatar Jul 14 '22 09:07 georgolden

I'd like to take this one

dmitryt avatar Jul 30 '22 08:07 dmitryt