Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Clarify use of type-specific facets in a union type #711

Closed
jstoiko opened this issue Jun 14, 2019 · 0 comments · Fixed by #736
Closed

Clarify use of type-specific facets in a union type #711

jstoiko opened this issue Jun 14, 2019 · 0 comments · Fixed by #736
Milestone

Comments

@jstoiko
Copy link
Contributor

jstoiko commented Jun 14, 2019

The description of the union type makes no mention of how to apply facets and the restrictions thereof.

Proposed clarification

  • Add that a union type MAY have any of its super types facets as long as all super types participating in that union accept those facets

Examples

types:
  Foo: number
  Bar: integer
  FooBar:
    type: Foo | Bar
    minimum: 1 # valid because both "Foo" (number) and "Bar" (integer) all accept "minimum"
types:
  Foo: number
  Bar: integer
  Qux: string
  FooBarQux:
    type: Foo | Bar | Qux
    minimum: 1 # invalid because "Qux" (string) does not accept the "minimum" facet
types:
  Foo: number
  Bar: integer
  Qux:
    type: string
    facets:
      minimum: number
  FooBarQux:
    type: Foo | Bar | Qux
    minimum: 1 # valid because "Qux" (string) has a user-defined facet "minimum"
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant