{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hypotheques-en-ligne-fr/json-schema/hypotheques-en-ligne-fr-commune-search-response-schema.json",
  "title": "CommuneSearchResponse",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/hypotheques-en-ligne-fr-api-openapi.yml#/components/schemas/CommuneSearchResponse",
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean",
      "description": "`true` si la recherche a abouti, `false` en cas d'erreur de paramètre."
    },
    "count": {
      "type": "integer",
      "description": "Nombre de communes retournées (20 max)."
    },
    "communes": {
      "type": "array",
      "description": "Communes correspondantes, au format \"CP VILLE\".",
      "items": {
        "$ref": "#/$defs/CommuneItem"
      }
    },
    "errors": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ErrorItem"
      }
    }
  },
  "$defs": {
    "CommuneItem": {
      "type": "object",
      "properties": {
        "code_postal_ville": {
          "type": "string",
          "description": "Commune au format \"CP VILLE\"."
        }
      }
    },
    "ErrorItem": {
      "type": "object",
      "description": "Détail d'une erreur de validation.",
      "properties": {
        "code": {
          "type": "string",
          "description": "Code machine de l'erreur.",
          "enum": [
            "AUTH_REQUIRED",
            "INVALID_TOKEN",
            "INVALID_JSON",
            "MISSING_FIELD",
            "INVALID_VALUE",
            "INVALID_COMBINATION",
            "LIMIT_EXCEEDED",
            "ALSACE_MOSELLE_RESTRICTION",
            "DUPLICATE_VALUE",
            "LOT_INCOMPLETE",
            "SERVER_ERROR"
          ]
        },
        "message": {
          "type": "string",
          "description": "Message explicatif en français."
        },
        "field": {
          "type": [
            "string",
            "null"
          ],
          "description": "Chemin du champ concerné (ex `parcelles[2].section_cadastrale`)."
        }
      }
    }
  }
}