Skip to content

Parsed schema contains nested "type" keysΒ #86

@devenjahnke

Description

@devenjahnke

When using the encodeRecord method on the RecordSerializer, I encounter an issue when the schemaId method is called on a Registry class to validate that the parsed schema is registered for the subject.

Specifically, the issue seems to stem from subtle differences between the parsed and remote schema. For example, the following snippet is the schema as it was parsed by this package after formatting by the prepareJsonSchemaForTransfer function:

{
    "name": "orders",
    "type": [
        {
            "type": "null"
        },
        {
            "type": "array",
            "items": {
                "type": "record",
                "name": "OrderRecord",
                "fields": [
                    {
                        "name": "id",
                        "type": {
                            "type": "string"
                        },
                        "doc": "Id(uuid v7) of the order"
                    },
                    {
                        "name": "isReady",
                        "type": {
                            "type": "boolean"
                        }
                    }
                ]
            }
        }
    ],
    "default": null,
    "doc": "Orders associated to customer"
}

Whereas, the following snippet is the schema returned from a GET request to the registry:

{
    "name": "orders",
    "type": [
        "null",
        {
            "type": "array",
            "items": {
                "type": "record",
                "name": "OrderRecord",
                "fields": [
                    {
                        "name": "id",
                        "type": "string",
                        "doc": "Id(uuid v7) of the order"
                    },
                    {
                        "name": "isReady",
                        "type": "boolean"
                    }
                ]
            }
        }
    ],
    "doc": "Orders associated to customer",
    "default": null
}

When I make a POST request to the registry for the subject with the second schema (returned by a GET request to the registry), I receive a successful response. But, when I make a POST request to the registry for the subject with the first schema (parsed by the package), I get the following error:

{
    "error_code": 40403,
    "message": "Schema not found io.confluent.rest.exceptions.RestNotFoundException: Schema not found
}

Any advice on the issue and how I can proceed is greatly appreciated. Cheers!

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