OpenAPITools / OpenAPITools/openapi-generator

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

Open
#19,585 3 comments 0 reactions 1 assignee View on GitHub

@kay-schecker is already working on this.

Since Jun 10, 2024.

Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

⚠️ 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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.