Skip to content

[Bug]: extra_format_unmarshallers get lost when instantiating V31RequestUnmarshaller #821

Closed
@claeyswo

Description

@claeyswo

Actual Behavior

I'm trying to instantiate a V31RequestUnmarshaller with extra_format_unmarshallers. Sometime during the initialization process however they get overwritten with None. No problem for the V31ResponseUnmarshaller

Expected Behavior

That the extra_format_unmarshallers dict is equal to the one I provide.

Steps to Reproduce

from jsonschema_path import SchemaPath

from openapi_core.unmarshalling.request import V31RequestUnmarshaller
from openapi_core.unmarshalling.response import V31ResponseUnmarshaller

spec_dict = {
    "openapi": "3.1.0",
    "info": {"version": "1.0.0", "title": "Foo"},
    "paths": {
        "/hello": {
            "post": {
                "requestBody": {
                    "required": True,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["id"],
                                "properties": {
                                    "id": {"type": "string", "format": "parse-id"}
                                },
                            }
                        }
                    },
                },
                "responses": {
                    "200": {"description": "Say hello"},
                    "400": {"description": "Bad Request"},
                },
            }
        }
    },
}

spec = SchemaPath.from_dict(spec_dict)

v31_request_unmarshaller = V31RequestUnmarshaller(
    spec, extra_format_unmarshallers={"parse-id": lambda x: x}
)
v31_response_unmarshaller = V31ResponseUnmarshaller(
    spec, extra_format_unmarshallers={"parse-id": lambda x: x}
)
print(v31_request_unmarshaller.extra_format_unmarshallers)
print(v31_response_unmarshaller.extra_format_unmarshallers)

Output:

None
{'parse-id': <function <lambda> at 0x79a6dc363e20>}

OpenAPI Core Version

0.19.0

OpenAPI Core Integration

pyramid_openapi3

Affected Area(s)

No response

References

No response

Anything else we need to know?

No response

Would you like to implement a fix?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugIndicates an issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions