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

Required field ignored in case of allOf #352

Open
yekver opened this issue Apr 4, 2022 · 2 comments · May be fixed by #861
Open

Required field ignored in case of allOf #352

yekver opened this issue Apr 4, 2022 · 2 comments · May be fixed by #861
Labels
duplicate This issue or pull request already exists

Comments

@yekver
Copy link
Contributor

yekver commented Apr 4, 2022

I have a MyType with a date field marked as a required. Unfortunately this requirement is mistakenly ignored by orval.

Example:

MyAnotherType:
    type: object
    properties:
      myProp:
        type: string
MyType:
  required:
    - date # ignored
  allOf:
    - $ref: '#/components/schemas/MyAnotherType'
    - type: object
      properties:
        date:
          type: string

Produces:

export interface MyAnotherType {
  myProp?: string;
}

export type MyTypeAllOf = {
  date?: string;
};

// Here MyType['date'] will be an optional field
export type MyType = MyAnotherType & MyTypeAllOf;
@anymaniax
Copy link
Owner

the required work at the schema level right now in the allOf. Don't know if it should also work there but probably

@yekver
Copy link
Contributor Author

yekver commented Apr 4, 2022

the required work at the schema level right now in the allOf. Don't know if it should also work there but probably

I think that it should because yaml compiles without any errors.

@anymaniax anymaniax added the enhancement New feature or request label Jun 13, 2022
yokoyama-takuya pushed a commit to pcae/orval that referenced this issue Jul 21, 2022
yokoyama-takuya pushed a commit to pcae/orval that referenced this issue Jul 21, 2022
yokoyama-takuya pushed a commit to pcae/orval that referenced this issue Jul 22, 2022
yokoyama-takuya pushed a commit to pcae/orval that referenced this issue Jul 25, 2022
yokoyama-takuya added a commit to pcae/orval that referenced this issue Jul 25, 2022
yokoyama-takuya pushed a commit to pcae/orval that referenced this issue Sep 21, 2022
yokoyama-takuya pushed a commit to pcae/orval that referenced this issue Sep 21, 2022
yokoyama-takuya pushed a commit to pcae/orval that referenced this issue May 17, 2023
@yokoyama-takuya yokoyama-takuya linked a pull request May 17, 2023 that will close this issue
yokoyama-takuya pushed a commit to pcae/orval that referenced this issue May 20, 2023
yokoyama-takuya pushed a commit to pcae/orval that referenced this issue May 20, 2023
@melloware melloware added duplicate This issue or pull request already exists and removed enhancement New feature or request labels Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants