-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
net.IP
and net.HardwareAddr
are represented incorrectly in the OpenAPI spec
#14160
Comments
@jwhonce PTAL - looks like an error with the API docs |
I'd be willing to implement a fix, but I need a few pointers on the best way to approach this. The simplest fix would be to change the struct field1 to a string, but that would be a breaking change, and there are other references to While investigating this, I found other suspicious fields. MacAddress:
$ref: '#/definitions/HardwareAddr'
description: |-
HardwareAddr is the same as net.HardwareAddr except
that it adds the json marshal/unmarshal methods.
This allows us to read the mac from a json string
and a byte array.
HardwareAddr:
items:
format: uint8
type: integer
title: A HardwareAddr represents a physical hardware address.
type: array
x-go-package: net Footnotes
|
I would consider the current API correct - it's the documentation that is incorrect. As such I would advise against changing any struct fields. The complexity here is that net.IP is a []uint8 but marshals into JSON as a string. |
Agreed, but as far as I can tell, there is currently no way to overwrite the type of a struct field with go-swagger. There is an open issue for this feature go-swagger/go-swagger#2599 |
The diff --git a/libpod/define/pod_inspect.go b/libpod/define/pod_inspect.go
index 219ffade2..c387856e5 100644
--- a/libpod/define/pod_inspect.go
+++ b/libpod/define/pod_inspect.go
@@ -82,6 +82,7 @@ type InspectPodInfraConfig struct {
HostNetwork bool
// StaticIP is a static IPv4 that will be assigned to the infra
// container and then used by the pod.
+ // swagger:strfmt ipv4
StaticIP net.IP
// StaticMAC is a static MAC address that will be assigned to the infra
// container and then used by the pod. |
Care to open a PR to make these changes? |
/libpod/pods/{name}/json
response does not match InspectPodResponse
schemanet.IP
and net.HardwareAddr
are represented incorrectly in the OpenAPI spec
A friendly reminder that this issue had no activity for 30 days. |
Since a fix for this was merged, I am going to close. |
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
The json response returned by
PodInspectLibpod
does not match the v4 OpenAPI schema. I'm using podman-api-rs and get the following error.invalid type: string "", expected a sequence at line 1 column 608
.This is the json response (formatted by me)
The field
InspectPodResponse.InfraConfig.StaticIP
is incorrect. The expected type is[]uint8
, but its value is a string.Steps to reproduce the issue:
/libpod/pods/{name}/json
Describe the results you received:
"StaticIP": ""
Describe the results you expected:
"StaticIP": [1,2,3,4]
or a different OpenAPI schemaAdditional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)
No
The text was updated successfully, but these errors were encountered: