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

[BUG] openapi-generator-cli doesnt validate empty enums #784

Open
nghiahsgs opened this issue Jun 10, 2024 · 2 comments
Open

[BUG] openapi-generator-cli doesnt validate empty enums #784

nghiahsgs opened this issue Jun 10, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@nghiahsgs
Copy link

⚠️ Important Notice

Please differentiate the bug

This repository is not responsible for the actual code generation. If you have problems with the code generation, please open the bug at OpenAPITools/openapi-generator.

Please also check if the bug is already known before you open a new bug.


🐛 Bug Report:

Describe the bug

A clear and concise description of what the bug is.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create sample file test.yaml
openapi: 3.0.3
info:
  title: Simple API with Enum
  description: A simple API to demonstrate enum usage in OpenAPI.
  version: 1.0.0

paths:
  /items:
    get:
      summary: Get a list of items
      responses:
        '200':
          description: A list of items
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Item'

components:
  schemas:
    Item:
      type: object
      properties:
        id:
          type: integer
          format: int64
          example: 1
        name:
          type: string
          example: "Sample Item"
        status:
          type: string
          enum: []


  1. Run command validate openapi-generator-cli validate test.yaml
  2. It didn't show error about empty enum
  3. It should be show error like this
    image
    image

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Operation System (please complete the following information):

  • OS: [e.g. Ubuntu ]
  • Version [e.g. 22]

Package System (please complete the following information):

  • Version [e.g. 22]

Additional context

Add any other context about the problem here.

@nghiahsgs nghiahsgs added the bug Something isn't working label Jun 10, 2024
@AndieNguyenSotatek
Copy link

I faced same issue

@AndieNguyenSotatek
Copy link

AndieNguyenSotatek commented Jun 10, 2024

image

I have a question:

When I run the command openapi-generator-cli validate test.yaml, how can I find the logic for the validate function? I searched the source code but couldn't find any relevant function.

Thank you very much !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants