swagger-api / swagger-api/swagger-codegen

Generator doesn't work with broken extensions

Open
#6,975 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

When I add an extension with wrong configured SPI generator can't start. Should generator just ignore broken extensions?

Swagger-codegen version

2.2.1

Swagger declaration file content or url
Command line used for generation
Steps to reproduce

Create a jar with META-INF/services/io.swagger.codegen.CodegenConfig file that contains class name for class that can't be found.

Related issues/PRs
Suggest a fix/enhancement

ServiceConfigurationError https://github.com/swagger-api/swagger-codegen/blob/4d4af7144656c80e8e63779191fd5a22fce65dc8/modules/swagger-codegen/src/main/java/io/swagger/codegen/Codegen.java#L126-L126 can be caught and logged 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.

Research direction

Start in modules/swagger-codegen/src/main/java/io/swagger/codegen/Codegen.java at line 126, where the ServiceConfigurationError is raised while loading extensions. Reproduce the issue with a jar whose META-INF/services/io.swagger.codegen.CodegenConfig names a missing class. Done means the generator starts with the broken extension present and the failure is logged.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.