OpenAPITools / OpenAPITools/openapi-generator

Generator fails with non-specific error instead of saying it doesn't support the version of OAS

Open
#12,876 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

I have an OpenAPI 3.1 API definition, which I converted from YAML to JSON because of https://github.com/OpenAPITools/openapi-generator/issues/9520

Attempting to generate any code with it fails, with only:
Exception in thread "main" java.lang.RuntimeException: Issues with the OpenAPI input. Possible causes: invalid/missing spec, malformed JSON/YAML files, etc.

openapi-generator version

6.0.1

OpenAPI declaration file content or url
{
  "openapi": "3.1.0",
  "info": {
    "version": "1.0.0",
    "title": "MediaDevice API",
...
}
Generation Details

The command I used:
openapi-generator-cli generate -i deviceAPI.json -g nodejs-express-server -o ~/node_server

Steps to reproduce

Try to generate code from any OAS 3.1 document (JSON currently because YAML is broken).

Suggest a fix

Raise an error message saying that the version of OAS is not supported by the generator.

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.

Research direction

Start by reproducing the openapi-generator-cli generate command with the supplied deviceAPI.json containing openapi: 3.1.0, then trace the generator's input-validation error path. Done means an unsupported OAS version produces a specific error instead of the generic input failure, with regression coverage for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.