-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[rust-server] lacks support for additionalProperties
#318
Comments
This may be at least partially a regression. The following spec worked in swagger-codegen: swagger: '2.0'
info:
description: "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\"
version: 1.0.0
title: OpenAPI Petstore
license:
name: Apache-2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
host: petstore.swagger.io:80
basePath: /v2
schemes:
- http
paths:
/pet:
post:
summary: Add a new pet to the store
description: ''
operationId: addPet
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: Pet object that needs to be added to the store
required: true
schema:
$ref: '#/definitions/additionalPropertiesObject'
responses:
'405':
description: Invalid input
definitions:
additionalPropertiesObject:
description: An additionalPropertiesObject
type: object
additionalProperties:
type: string
example: "foo" |
OK - what's happened is that we never supported additional properties. openapi-generator introduced a regression that caused a compile failure. I've put in a workaround in #671 to restore things to how they previously were - i.e. that the |
We still don't entirely support additional properties - e.g. we don't support objects which mix additional properties and non-additional properties. |
Description
See swagger-api/swagger-codegen#8089 (comment) - our main bar to using the same swagger spec for sample generation as the other generators is that
rust-server
does not yet supportadditionalProperties
.Admittedly, this seems like a non-trivial problem.
rust-server
is intended to provide a distributed strongly-typed system. As soon as you addadditionalProperties
, however, we lose the ability to be able to verify the contents of said additional properties.A naive solution might be:
However, this will fail as soon as we introduce non-json media types (e.g. XML, which
rust-server
supports). As such, I'm not sure what a complete solution would look like...openapi-generator version
OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
The text was updated successfully, but these errors were encountered: