OpenAPITools / OpenAPITools/openapi-generator
[Typescript Angular] oneOf with schemas 7.0.0-beta "Could not process model"
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
When generating the MODELS/Services using Open Api Generator 7.0.0-beta i get the following error:
Exception in thread "main" java.lang.RuntimeException: Could not process model 'Dummy'.Please make sure that your schema is correct!
at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:529)
at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:950)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:487)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
When using 6.6.0, the Models and Services where generated successfully
openapi-generator version
7.0.0-beta, it did work with 6.6.0
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: testy
version: 1.0.1
servers:
- description: Dummy localhost server
url: 'http://localhost:8080/dummy'
tags:
- description: 'Dummy Operation'
name: DummyOpertaion
paths:
'/v1/dummy':
get:
operationId: DummyOperation
responses:
'200':
content:
application/json:
schema:
description: Response of the Dummy operation.
properties:
testy: &ref_1
oneOf:
- properties:
dummy:
type: string
- properties:
dummy2:
type: number
title: Dummy
type: object
notWorkingTesty:
$ref: '#/components/schemas/Dummy'
type: object
description: 'Testy'
components:
schemas:
Dummy: *ref_1
following "same" yaml (without shortcut references) is working fine:
openapi: 3.0.3
info:
title: testy
version: 1.0.1
servers:
- description: Dummy localhost server
url: 'http://localhost:8080/dummy'
tags:
- description: 'Dummy Operation'
name: DummyOpertaion
paths:
'/v1/dummy':
get:
operationId: DummyOperation
responses:
'200':
content:
application/json:
schema:
description: Response of the Dummy operation.
properties:
testy:
$ref: '#/components/schemas/Dummy'
notWorkingTesty:
$ref: '#/components/schemas/Dummy'
type: object
description: 'Testy'
components:
schemas:
Dummy:
oneOf:
- properties:
dummy:
type: string
- properties:
dummy2:
type: number
Generation Details
Running the following Command:
java -jar C:\git\fip\frontend\libs\core\api\dist\openapi-generator-cli-7.0.0-beta.jar
generate
-g typescript-angular
-i C:\git\fip\frontend\libs\core\api\src\lib\test\original.yaml
-o C:\git\fip\frontend\libs\core\api\src\lib\test
--generate-alias-as-model
--config C:\git\fip\frontend\libs\core\api\generate\test-config-options.json
with the following options (test-config-options.json)
{
"ngVersion": "16.1.1",
"configurationPrefix": "Test",
"apiModulePrefix": "Test",
"modelSuffix": "Test"
}
Steps to reproduce
Command, YAML and Options already declared
Related issues/PRs
Nothing found
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
Run the supplied openapi-generator command with the anchored and expanded YAML examples, comparing 7.0.0-beta with 6.6.0. Start from the reported path through DefaultGenerator.java, Generate.java, OpenApiGeneratorCommand.java, and OpenAPIGenerator.java. Done means typescript-angular models and services generate successfully for the anchored oneOf schema.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, java, openapi, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100