OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.31k stars 6.45k forks source link

[BUG] [Rust Server] Not support free-form object code generated issue. #5969

Open paladinzh opened 4 years ago

paladinzh commented 4 years ago

Bug Report Checklist

Description

Not support free-form object code generated

openapi-generator version
OpenAPI declaration file content or url

modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml get: tags: [Repo, Info] operationId: Get Repo\Info responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/RepoObject"

RepoObject: type: object

Command line used for generation

bin/rust-server-petstore.sh

Steps to reproduce

Run the generated code openapi-v3/

Related issues/PRs

No

Suggest a fix

Allow generate free-form object.

wing328 commented 4 years ago

You can use {{#isFreeFormObject}} .. {{/isFreeFormObject}} in the template

AmateurECE commented 1 year ago

You can use {{#isFreeFormObject}} .. {{/isFreeFormObject}} in the template

As of 6.3.0, this suggestion has no effect (presumably since #7373 was merged). The provided example in the problem statement appears to be a (quoting the source)

// 1. free form with no validation that is not allOf included in any composed schemas

It seems like this case is disallowed, or otherwise not implemented in DefaultGenerator.java:490. Apparently, however, this is a common enough practice that DMTF's Redfish specification contains 33 examples of this. I'm not sure why this PR was abandoned, but is the community still willing to entertain a PR to resolve this?