OpenAPITools / OpenAPITools/openapi-generator
[BUG][JAVA] Description
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
If path to OpenAPI 3 specification file contains spaces you get an error
com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'openapi': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
Everything generates just fine if there is no spaces and backslashes in path
openapi-generator version
5.0.0
OpenAPI declaration file content or url
openapi: 3.0.1
info:
title: SOME REST API
description: SOME REST API
version: 1.0.3
servers:
- url: /api
description: current environment
- url: http://localhost:8080/api
paths:
/somePath:
get:
responses:
200:
description: Request OK.
content:
'text/plain':
schema:
type: string
Generation Details
java -jar openapi-generator-cli-5.jar generate -i "C:\Idea Projects\dummy\dummy.yml" -g java -o "C:\Idea Projects\dummy\results" --library rest-assured --api-package "com.example.dummy.api" --model-package "com.example.dummy.model" --invoker-package "com.example.dummy.invoker"
everything works fine with
java -jar openapi-generator-cli-5.jar generate -i "C:/IdeaProjects/dummy/dummy.yml" -g java -o "C:/IdeaProjects/dummy/results" --library rest-assured --api-package "com.example.dummy.api" --model-package "com.example.dummy.model" --invoker-package "com.example.dummy.invoker"
Steps to reproduce
- Try to generate sources from openAPI 3 spec file which path contains spaces or backslashes
Related issues/PRs
Suggest a fix
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the openapi-generator-cli 5.0.0 generate command with the supplied OpenAPI 3 YAML file and Windows input paths containing spaces and backslashes. Trace how the -i input path is parsed before the specification is read; done means generation succeeds for those paths as it already does for paths using forward slashes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100