Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add carry-on types and manyfold object union types #8

Open
miroir-framework opened this issue Jun 17, 2024 · 0 comments
Open

add carry-on types and manyfold object union types #8

miroir-framework opened this issue Jun 17, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@miroir-framework
Copy link
Owner

miroir-framework commented Jun 17, 2024

Add carry-on types, usable (among other cases) with heteronomous unions:

{
  type: "object",
  definition: {
    a: string,
    b: { c: number }
  },
  carryOn: {
    d: boolean
  } 
}

shall result in a TS type (and Zod schema) corresponding to:

{ a: string | { d: boolean }, b: { c: number  |  { d: boolean } }  |  { d: boolean } } 

For unions among object types, many discriminators can be found, implying the existence of manyfold object union types, that are union types of objects, in which there are many attributes used as discriminators. This is not semantically relevant, as discriminated unions do not exist as a prime citizen in TS types, being treated as any other union. This is however pragmatically relevant, guiding the use of such an object union type. The possibility of having an array of discriminators on a union type shall thus be considered in that perspective.

@miroir-framework miroir-framework added the enhancement New feature or request label Jun 17, 2024
@miroir-framework miroir-framework self-assigned this Jun 17, 2024
@miroir-framework miroir-framework added this to the 0.8.0 milestone Jun 17, 2024
@miroir-framework miroir-framework changed the title add carry-on types add carry-on types and heteronomous unions Jun 17, 2024
@miroir-framework miroir-framework changed the title add carry-on types and heteronomous unions add carry-on types, heteronomous unions Jun 18, 2024
@miroir-framework miroir-framework changed the title add carry-on types, heteronomous unions add carry-on types, heteronomous unions, and manyfold object union types Jun 18, 2024
@miroir-framework miroir-framework changed the title add carry-on types, heteronomous unions, and manyfold object union types add carry-on types and manyfold object union types Jun 18, 2024
miroir-framework added a commit that referenced this issue Jun 18, 2024
…pes #8. Testing heteronomous unions and adding manyfold object union types (discriminators are ignored upon conversion to Zod schemas).
miroir-framework added a commit that referenced this issue Jun 20, 2024
…arryOn attribute interpretation limited to JzodObject.
miroir-framework added a commit that referenced this issue Jun 20, 2024
…arryOn attribute interpretation on Union types.
miroir-framework added a commit that referenced this issue Jun 24, 2024
…arryOn attribute interpretation on SchemaReferences limited to relative references for context-defined subSchemas.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

1 participant