Skip to content

Conversation

@paladinzh
Copy link
Contributor

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

PR checklist

  • Read the contribution guidelines.
  • If contributing template-only or documentation-only changes which will change sample output, build the project before.
  • Run the shell script(s) under ./bin/ (or Windows batch scripts under.\bin\windows) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the code or mustache templates for a language ({LANG}) (e.g. php, ruby, python, etc).
  • File the PR against the correct branch: master, 4.3.x, 5.0.x. Default: master.
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

@paladinzh paladinzh closed this Apr 17, 2020
AmateurECE added a commit to AmateurECE/openapi-generator that referenced this pull request Jan 24, 2023
Issue OpenAPITools#5969 and PR OpenAPITools#5970 document an issue with rust-server where free form
models are not generated. OpenAPITools#7373 adds some free form model generation to
python-experimental (later ported to other languages, it seems), but this
feature only covers two of three possible use cases. The third use case remains
unimplemented, though it is used in some larger OpenAPI document sets, such as
DMTF's Redfish schema (which contains 33 of these free form objects without
validation).

related functions), but there does not seem to be an adequate replacement for
detecting free form objects in the OpenAPI data model from template context.
Unfortunately, free form objects require special consideration in statically
type-checked languages such as Rust.

quickly closed, presumably because `isFreeFormObject` was still present in the
data model at the time the issue was opened.

This commit adds a global property (default `false`) called
`generateFreeFormModels` (I'm taking suggestions for a better name) which
enables generation for the third use case not addressed by OpenAPITools#7373. Additionally,
isFreeFormObject is added back into the object model for any case where a
free-form object is generated, allowing generators for languages such as Rust
to handle them gracefully.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant