Skip to content

Roundtripping T via JSON leaves requestBody properties without populated Value #1081

@andig

Description

@andig

What am I doing: parse a spec containing requestBody into an openapi3.T:

    "/session/{id}": {
      "put": {
        "description": "Update vehicle of charging session. [Read more.](https://docs.evcc.io/en/docs/features/sessions)\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "loadpoint": {
                    "$ref": "#/components/schemas/LoadpointName"
                  },
                  "vehicle": {
                    "$ref": "#/components/schemas/VehicleName"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        },
        "summary": "Update vehicle of charging session",
        "tags": [
          "Sessions"
        ]
      }
    },

Everything is fine working with this T, specifically the requestBodys schema parameters are fully populated, i.e. their Value is non-nil.

After roundtripping this openapi.T via JSON, the requestBodys schema parameter's Values are nil. It seems as if something is missing in the JSON unmarshaling regarding fully resolving the schema references.

This sounds a lot like both #1078 and also #1074.

Since this issue is blocking us from caching a parsed API spec instead of parsing it every time I'd be happy to sponsor getting this fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions