Skip to content

Localities endpoint sometimes returns district = null, contradicting Swagger (DE, states 01/02) #17

@jens-muenker

Description

@jens-muenker

The endpoint /de/FederalStates/{key}/Localities occasionally returns localities without district, although the Swagger marks district as required. The generated Kotlin client therefore fails with MissingKotlinParameterException.

Affected examples (DE):

  • State 01 (Schleswig-Holstein), page 1: localities contain district
curl -X 'GET' \
  'https://openplzapi.org/de/FederalStates/02/Localities?page=1&pageSize=50' \
  -H 'accept: application/json'
  • State 02 (Hamburg), page 1: localities does not contain district
curl -X 'GET' \
  'https://openplzapi.org/de/FederalStates/02/Localities?page=1&pageSize=50' \
  -H 'accept: application/json'

Swagger excerpt:
OpenPlzApi.DE.LocalityResponse lists district in required:

"OpenPlzApi.DE.LocalityResponse": {
        "required": [
          "district",
          "federalState",
          "municipality",
          "name",
          "postalCode"
        ],
        "type": "object",
        "properties": {
          "district": {
            "$ref": "#/components/schemas/OpenPlzApi.DE.DistrictSummary"
          },
          "federalState": {
            "$ref": "#/components/schemas/OpenPlzApi.DE.FederalStateSummary"
          },
          "municipality": {
            "$ref": "#/components/schemas/OpenPlzApi.DE.MunicipalitySummary"
          },
          "name": {
            "minLength": 1,
            "type": "string",
            "description": "Name (Ortsname)",
            "readOnly": true,
            "example": "Bendorf"
          },
          "postalCode": {
            "minLength": 1,
            "type": "string",
            "description": "Postal code (Postleitzahl)",
            "readOnly": true,
            "example": "56170"
          }
        },
        "additionalProperties": false,
        "description": "Representation of a German locality (Ort oder Stadt)",
        "readOnly": true
      }

Expected behavior:

  • Either district is always present (never null/missing), or
  • Swagger marks district as optional/nullable (not in required), so the generated client doesn’t crash.

Actual behavior:

  • API responses sometimes contain district: null or omit the field.

Proposed fix:

  • Either always include district in responses, or
  • Mark district as optional/nullable in Swagger to match real responses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions