{
    "openapi": "3.0.3",
    "info": {
        "title": "Data Liberec — API otevřených dat",
        "version": "1.0.0",
        "description": "Zveřejněné otevřené datové sady Statutárního města Liberec a dalších poskytovatelů. Bez registrace a bez klíče; nejvýš 300 požadavků za minutu z jedné adresy. Podmínky užití jsou u každé sady.",
        "license": {
            "name": "Podmínky užití jednotlivých sad (CC BY 4.0 / CC0)",
            "url": "https://opendata.liberec.cz/o-datech"
        }
    },
    "servers": [
        {
            "url": "https://opendata.liberec.cz/api/v1"
        }
    ],
    "paths": {
        "/sady": {
            "get": {
                "summary": "Seznam zveřejněných datových sad",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "description": "Hledaný text v názvu, popisu a klíčových slovech",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "tema",
                        "in": "query",
                        "description": "Kód tématu EU (např. ENVI, TRAN, GOVE)",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Seznam sad"
                    }
                }
            }
        },
        "/sady/{slug}": {
            "get": {
                "summary": "Metadata sady, sloupce a soubory ke stažení",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "description": "Identifikátor datové sady (např. sberne-dvory)",
                        "schema": {
                            "type": "string",
                            "pattern": "^[a-z0-9-]+$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Detail sady"
                    },
                    "404": {
                        "description": "Chyba",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Chyba"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/sady/{slug}/data": {
            "get": {
                "summary": "Řádky dat tabulkové sady",
                "description": "Filtrovat lze rovností podle libovolného sloupce: ?{klic}=hodnota.",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "description": "Identifikátor datové sady (např. sberne-dvory)",
                        "schema": {
                            "type": "string",
                            "pattern": "^[a-z0-9-]+$"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 100,
                            "maximum": 1000
                        }
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 0
                        }
                    },
                    {
                        "name": "razeni",
                        "in": "query",
                        "description": "Klíč sloupce, s pomlčkou na začátku sestupně (např. -kapacita)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "json",
                                "csv"
                            ],
                            "default": "json"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Stránka dat",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            },
                            "text/csv": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Chyba",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Chyba"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "Chyba": {
                "type": "object",
                "properties": {
                    "chyba": {
                        "type": "string"
                    },
                    "kod": {
                        "type": "integer"
                    }
                }
            },
            "Data": {
                "type": "object",
                "properties": {
                    "sada": {
                        "type": "string"
                    },
                    "celkem": {
                        "type": "integer"
                    },
                    "offset": {
                        "type": "integer"
                    },
                    "limit": {
                        "type": "integer"
                    },
                    "dalsi": {
                        "type": "string",
                        "nullable": true
                    },
                    "data": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    }
                }
            }
        }
    }
}