OpenAPITools / OpenAPITools/openapi-generator
[BUG][scala-play-server] additionalProperties settings is not working and generated code is having compilation issue
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
Generated source having compilation issue for generator 'scala-play-server'.
- additionalProperties - does not have any type added by default unless we specify additionalProperties=true
- Attribute present before additionalProperties does not ends with comma(,) at the end which leads to compilation error.
package model
import play.api.libs.json._
/**
* A category for a pet
* @param additionalProperties Any additional properties this model may have.
*/
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"))
case class Category(
id: Option[Long],
name: Option[String]
additionalProperties:
)
openapi-generator version
Latest master branch code
OpenAPI declaration file content or url
Generation Details
Navigate to root folder of this project and issue below command after building.
java -jar ./modules/openapi-generator-cli/target/openapi-generator-cli.jar generate --generator-name="scala-play-server" --input-spec=modules/openapi-generator/src/test/resources/3_0/petstore.yaml --output=samples/server/petstore/scala-play-server
Steps to reproduce
- Clone master branch
- Open terminal in mac
- issue command ./mvnw
- Once build is successful, try issue below command to regenerate samples - bin/generate-samples.sh
- Notice the samples present samples/server/petstore/scala-play-server/app/model/ and we can see above mentioned two issues.
Expected output:
package model
import play.api.libs.json._
/**
* A category for a pet
*/
case class Category(
id: Option[Long],
name: Option[String]
)
object Category {
implicit lazy val categoryJsonFormat: Format[Category] = Json.format[Category]
}
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
Build the project with ./mvnw, then reproduce with the scala-play-server command using modules/openapi-generator/src/test/resources/3_0/petstore.yaml. Inspect the generated model under samples/server/petstore/scala-play-server/app/model/, especially Category.scala, and compare it with the expected output in the issue. Done means the generated Scala source compiles and the additionalProperties and comma handling match the expected model.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- api, backend, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100