OpenAPITools / OpenAPITools/openapi-generator

[BUG][SCALA-AKKA] Doesn't generate models when defined inline (reproduced for java & scala-akka)

Open
#8,966 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Scala Issue: Bug
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? No models generated vs models generated
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Running java -jar openapi-generator-cli.jar generate -i 'swagger.json' -g scala-akka -o scala_client --generate-alias-as-model (also without config and/or without --generate-alias-as-model), doesn't produce any model libs.

Removing "additionalProperties": false, from the inline schema def makes it generate model classes. What also works is to define the schema using definitions + "$ref" : "..." - but that's not really feasible with the library I'm using for my server.

openapi-generator version

5.0.1 and also tested with openapi-generator-cli-5.1.0-20210304.083949-99.jar

OpenAPI declaration file content or url

swagger.json gist

Generation Details

X

Steps to reproduce

Just run java -jar openapi-generator-cli.jar generate -i 'swagger.json' -g scala-akka -o scala_client where swagger.json is the file I linked above, and the jar is either 5.0.1 or the snapshot version I mentioned.

Related issues/PRs

X

Suggest a fix

Somehow removing "additionalProperties": false, from the inline schema def makes it generate model classes. Setting it to true doesn't help either (not sure true is valid though). Referencing it with "$ref": "..." and moving the schema to definitions also solves this (but I can't use that solution due to the. lib I'm using).

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 running the documented openapi-generator command with the linked swagger.json gist and compare generation with an inline schema containing additionalProperties: false. Trace the scala-akka model-generation path, then verify that models are generated for the reproduced case and add a regression test if the relevant test location is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi, scala
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.