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

Support oneOf in schema definition #16

Open
Szer opened this issue Apr 3, 2020 · 0 comments
Open

Support oneOf in schema definition #16

Szer opened this issue Apr 3, 2020 · 0 comments

Comments

@Szer
Copy link
Owner

Szer commented Apr 3, 2020

oneOf basically means union type
We could encode them with F# DUs

    paths:
      /pets:
        patch:
          requestBody:
            content:
              application/json:
                schema:
                  oneOf:
                    - $ref: '#/components/schemas/Cat'
                    - $ref: '#/components/schemas/Dog'
          responses:
            '200':
              description: Updated
    components:
      schemas:
        Dog:
          ...
        Cat:
          ...

should generate

// usual generation of type objects
type Dog = ... 
type Cat = ... 

type CatOrDog = //generatedName
  | Cat of Cat
  | Dog of Dog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant