-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
[BUG] std::option::Option<&str>
cannot be formatted with the default formatter
#20145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey there @mickvangelderen I am assuming you are using this Open API spec provided by Kubernetes. I was able to reproduce the bug. As part of "parameters": [
{
"description": "name of the NodeProxyOptions",
"in": "path",
"name": "name",
"required": true,
"type": "string",
"uniqueItems": true
},
{
"$ref": "#/parameters/path-z6Ciiujn"
},
{
"$ref": "#/parameters/path-rFDtV0x9"
}
],
// .....
"path-rFDtV0x9": {
"description": "Path is the URL path to use for the current proxy request to node.",
"in": "query",
"name": "path",
"type": "string",
"uniqueItems": true
},
"path-z6Ciiujn": {
"description": "path to the resource",
"in": "path",
"name": "path",
"required": true,
"type": "string",
"uniqueItems": true
},
Interesting, there are 2 parameters for I believe this is probably what is causing the client generator to get confused. Looking at the k8s API I am not sure what the difference is, but I think regardless it would be good to make the openapi generator be able to support APIs where there is a path param and query param with the same name |
Also I noticed this only happens when using Below is a simplified reproducible example swagger: "2.0"
info:
description: "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters."
version: "1.0.0"
title: "Swagger Petstore 2.0"
termsOfService: "http://swagger.io/terms/"
contact:
email: "[email protected]"
license:
name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "petstore.swagger.io"
basePath: "/v2"
tags:
- name: "pet"
description: "Everything about your Pets"
externalDocs:
description: "Find out more"
url: "http://swagger.io"
- name: "store"
description: "Access to Petstore orders"
- name: "user"
description: "Operations about user"
externalDocs:
description: "Find out more about our store"
url: "http://swagger.io"
schemes:
- "https"
- "http"
paths:
/pet/{petId}:
get:
tags:
- "pet"
summary: "Find pet by ID"
description: "Returns a single pet"
operationId: "getPetById"
produces:
- "application/xml"
- "application/json"
parameters:
- $ref: '#/parameters/petId1'
- $ref: '#/parameters/petId2'
responses:
"200":
description: "successful operation"
schema:
$ref: "#/definitions/Pet"
"400":
description: "Invalid ID supplied"
"404":
description: "Pet not found"
definitions:
Pet:
type: "object"
required:
- "name"
- "photoUrls"
properties:
id:
type: "integer"
format: "int64"
xml:
name: "Pet"
parameters:
petId1:
name: "petId"
in: "path"
description: "ID of pet to return"
required: true
type: "string"
petId2:
name: "petId"
in: "query"
description: "ID of pet to return"
required: false
type: "string" |
Okay after a bit more investigating, the issue appears to be in the swagger-parser. There is an open issue here: swagger-api/swagger-parser#2102 |
And this is not a problem with only the Rust clients. This should be a problem with most languages. |
Bug Report Checklist
Description
I'm using the
rust
generator to generate a client for our kubernetes API server.The generated client code fails to compile with:
The generated code:
openapi-generator version
Happens on:
OpenAPI declaration file content or url
Can't share but it is a Kubernetes OpenAPI V2 spec.
Generation Details
Steps to reproduce
Related issues/PRs
format!
but it doesn't implDisplay
#16975Suggest a fix
Perhaps the last part of the URL
/{path}
or just{path}
(not the slash) should be left off ifpath
isNone
.The text was updated successfully, but these errors were encountered: