From 23ea0e397c9ac7ec0dfa963121237a3c2593f9fa Mon Sep 17 00:00:00 2001 From: Guylene Tandeau Date: Mon, 20 Jan 2025 15:20:22 +0100 Subject: [PATCH] feat: add services geo/departement/{code}/precedents geo/departement/{code}/projetes inherit from geo/departement/{code}/descendants, with the additional attribute dateSuppression (the same example for both) + declination of dateActive definitions --- src/main/resources/openapi.yaml | 485 ++++++++++++++++++++++++++------ 1 file changed, 400 insertions(+), 85 deletions(-) diff --git a/src/main/resources/openapi.yaml b/src/main/resources/openapi.yaml index e6b185d..c3a52d1 100644 --- a/src/main/resources/openapi.yaml +++ b/src/main/resources/openapi.yaml @@ -29,7 +29,7 @@ paths: summary: 'Informations sur un departement identifié par son code (deux ou trois caractères)' operationId: 'getcogdep' parameters: - - $ref: '#/components/parameters/dateActive' + - $ref: '#/components/parameters/dateDepartementActif' - $ref: '#/components/parameters/codeDepInPath' responses: '200': @@ -51,12 +51,53 @@ paths: operationId: 'getcogdepdesc' parameters: - $ref: '#/components/parameters/codeDepInPath' - - $ref: '#/components/parameters/dateActive' + - $ref: '#/components/parameters/dateTerritoiresActifsDansDepartement' - $ref: '#/components/parameters/filtreNom' - - $ref: '#/components/parameters/typeTerritoire' + - $ref: '#/components/parameters/typeTerritoireInclusDansDepartement' + responses: + '200': + $ref: '#/components/responses/ListeDescendantsDepartement200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/departement/{code}/precedents: + get: + tags: + - geoDepartement + summary: 'Informations concernant les departements qui précèdent le departement' + operationId: 'getcogdepprec' + parameters: + - $ref: '#/components/parameters/dateDepartementDepart' + - $ref: '#/components/parameters/codeDepInPath' responses: '200': - $ref: '#/components/responses/Descendants200' + $ref: '#/components/responses/ListeDepartementsWithDateSuppression200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/departement/{code}/projetes: + get: + tags: + - geoDepartement + summary: 'Informations concernant les départements qui résultent de la projection du département à la date passée en paramètre.' + operationId: 'getcogdepproj' + parameters: + - $ref: '#/components/parameters/codeDepInPath' + - $ref: '#/components/parameters/dateDepartementDepart' + - $ref: '#/components/parameters/dateProjection' + responses: + '200': + $ref: '#/components/responses/ListeDepartementsWithDateSuppression200' '400': $ref: '#/components/responses/IncorrectRequest' '404': @@ -73,12 +114,12 @@ paths: Informations sur toutes les communes actives à la date donnée. Par défaut, c'est la date courante. operationId: 'getcogcomliste' parameters: - - $ref: '#/components/parameters/dateActive' + - $ref: '#/components/parameters/dateCommunesActives' - $ref: '#/components/parameters/filtreNom' - $ref: '#/components/parameters/com' responses: '200': - $ref: '#/components/responses/CommuneListe200' + $ref: '#/components/responses/CommunesListe200' '400': $ref: '#/components/responses/IncorrectRequest' '404': @@ -131,10 +172,51 @@ components: description: 'Code de la commune (cinq caractères)' schema: $ref: '#/components/schemas/CodeCom' + dateDepartementActif: + in: query + description: |- + Filtre pour renvoyer la département actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsDansDepartement: + in: query + description: |- + Filtre pour renvoyer les territoires inclus dans le département actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ') + name: dateTerritoiresActifsDansDepartement + schema: + type: 'string' + format: date + dateDepartementDepart: + in: query + description: |- + Filtre pour préciser le département de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ') + name: dateDepartementDepart + schema: + type: 'string' + format: date + dateProjection: + required: true + in: query + description: |- + Date vers laquelle est projeté le departement. Paramètre obligatoire (Format : 'AAAA-MM-JJ') + name: dateProjection + schema: + type: 'string' + format: date dateActive: in: query description: |- - Filtre pour renvoyer la commune active à la date donnée. Par défaut, c'est la date courante. (Format : 'AAAA-MM-JJ') + Filtre pour renvoyer la commune active à la date donnée. Par défaut, c'est la date courante (format : 'AAAA-MM-JJ'). + name: date + schema: + type: 'string' + format: date + dateCommunesActives: + in: query + description: |- + Filtre pour renvoyer les communes actives à la date donnée. Par défaut, c'est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. name: date schema: type: 'string' @@ -142,9 +224,15 @@ components: typeTerritoire: name: 'type' in: query - description: 'Filtre sur le type de territoire renvoyé.' + description: 'Filtre sur le type de territoire renvoyé' schema: $ref: '#/components/schemas/TypeEnum' + typeTerritoireInclusDansDepartement: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumInclusDansDepartement' filtreNom: name: 'filtreNom' in: query @@ -156,12 +244,59 @@ components: name: 'com' in: 'query' description: |- - Sélectionner `true` pour inclure les collectivités d'outre-mer + Sélectionner "true" pour inclure les collectivités d'outre-mer schema: type: boolean - default: false - example: false + example: false + examples: + Departement: + value: + code: '22' + uri: 'http://id.insee.fr/geo/departement/f07f6a49-9dce-4f2d-a99e-5d61eedf2827' + type: 'Departement' + dateCreation: '1990-03-08' + intituleSansArticle: 'Côtes-d''Armor' + typeArticle: '4' + chefLieu": '22278' + intitule: 'Côtes-d''Armor' + ListeDescendantsDepartement: + value: + - code: '221' + uri: 'http://id.insee.fr/geo/arrondissement/1e07b989-b3ff-43be-bfe6-05e9c9ba19d7' + type: 'Arrondissement' + dateCreation: '2017-01-01' + intituleSansArticle: 'Dinan' + typeArticle: '0' + chefLieu: '22050' + intitule: 'Dinan' + - code: '222' + uri: 'http://id.insee.fr/geo/arrondissement/87fdca9c-f9ed-41e5-93d9-f44534ffd725' + type: 'Arrondissement' + dateCreation: '2017-01-01' + intituleSansArticle: 'Guingamp' + typeArticle: '0' + chefLieu: '22070' + intitule: 'Guingamp' + - code: 'code' + uri: 'uri' + type: 'Arrondissement' + dateCreation: 'dateCreation' + intituleSansArticle: 'intituleSansArticle' + typeArticle: 'typeArticle' + chefLieu: 'chefLieu' + intitule: 'intitule' + ListeDepartementsWithDateSuppression: + value: + - code: '22' + uri: 'http://id.insee.fr/geo/departement/95af7065-d100-4c4f-afd5-764edfe9ae9b' + type: 'Departement' + dateCreation: '1943-01-01' + dateSuppression: '1990-03-08' + intituleSansArticle: 'Côtes-du-Nord' + typeArticle: '4' + chefLieu": '22278' + intitule: 'Côtes-du-Nord' CommuneXML: externalValue: |- @@ -172,24 +307,38 @@ components: Abergement-de-Varey L'Abergement-de-Varey - CommuneListe: + CommunesListe: value: - - code: '01002' - uri: 'http://id.insee.fr/geo/commune/43018c68-c278-433a-b285-3531e8d5347e' + - code: '25073' + uri: 'http://id.insee.fr/geo/commune/2ac33139-2a97-4b09-87b3-263cbf14c0b6' + type: 'Commune' dateCreation: '1943-01-01' + intituleSansArticle: 'Bonnay' + typeArticle: '0' + intitule: 'Bonnay' + - code: '71042' + uri: 'http://id.insee.fr/geo/commune/2ee9b3c8-9861-40a0-af5e-f84ce2f2b3bc' type: 'Commune' - typeArticle: '5' - intituleSansArticle: 'Abergement-de-Varey' - intitule: 'L''Abergement-de-Varey' + dateCreation: '2023-01-01' + intituleSansArticle: 'Bonnay-Saint-Ythaire' + typeArticle: '0' + intitule: 'Bonnay-Saint-Ythaire' + - code: '80112' + uri: 'http://id.insee.fr/geo/commune/98c861ac-6da4-4f18-ba45-665bae059c5f' + type: 'Commune' + dateCreation: '1943-01-01' + intituleSansArticle: 'Bonnay' + typeArticle: '0' + intitule: 'Bonnay' Commune: value: - code: '01002' - uri: 'http://id.insee.fr/geo/commune/43018c68-c278-433a-b285-3531e8d5347e' - dateCreation: '1943-01-01' + code: '14475' + uri: 'http://id.insee.fr/geo/commune/4b88116a-9ede-42f5-aef5-a70304de593b' type: 'Commune' - typeArticle: '5' - intituleSansArticle: 'Abergement-de-Varey' - intitule: 'L''Abergement-de-Varey' + dateCreation: '2017-01-01' + intituleSansArticle: 'Val d''Arry' + typeArticle: '0' + intitule: 'Val d''Arry' responses: IncorrectRequest: description: 'La syntaxe de la requête est incorrecte' @@ -199,45 +348,66 @@ components: description: 'L''en-tête HTTP ''Accept'' contient une valeur non acceptée' ServerError: description: 'Erreur interne du serveur' - Descendants200: - description: 'Opération réussie pour les descendants d''un territoire' - # links: - # territoire: - # operationId: getTerritoireByTypeAndCode - # parameters: - # typeTerritoire: $response.body#/type - # code: $response.body#/code + ListeDescendantsDepartement200: + description: 'Opération réussie pour les descendants d''un département' content: application/json: schema: - $ref: '#/components/schemas/ListeTerritoires' + $ref: '#/components/schemas/ListeDescendantsDepartement' + examples: + défaut: + $ref: '#/components/examples/ListeDescendantsDepartement' application/xml: schema: - $ref: '#/components/schemas/ListeTerritoires' + $ref: '#/components/schemas/ListeDescendantsDepartement' + examples: + défaut: + $ref: '#/components/examples/ListeDescendantsDepartement' Departement200: description: 'Opération réussie pour le département' content: application/json: schema: $ref: '#/components/schemas/Departement' + examples: + défaut: + $ref: '#/components/examples/Departement' application/xml: schema: $ref: '#/components/schemas/Departement' - CommuneListe200: + examples: + défaut: + $ref: '#/components/examples/Departement' + ListeDepartementsWithDateSuppression200: + description: 'Opération réussie pour le département' + content: + application/json: + schema: + $ref: '#/components/schemas/ListeDepartementsWithDateSuppression' + examples: + défaut: + $ref: '#/components/examples/ListeDepartementsWithDateSuppression' + application/xml: + schema: + $ref: '#/components/schemas/ListeDepartementsWithDateSuppression' + examples: + défaut: + $ref: '#/components/examples/ListeDepartementsWithDateSuppression' + CommunesListe200: description: 'Opération réussie' content: application/json: schema: - $ref: '#/components/schemas/CommuneListe' + $ref: '#/components/schemas/CommunesListe' examples: défaut: - $ref: '#/components/examples/CommuneListe' + $ref: '#/components/examples/CommunesListe' application/xml: schema: - $ref: '#/components/schemas/CommuneListe' + $ref: '#/components/schemas/CommunesListe' examples: défaut: - $ref: '#/components/examples/CommuneListe' + $ref: '#/components/examples/CommunesListe' Commune200: description: Opération réussie content: @@ -254,6 +424,96 @@ components: défaut: $ref: '#/components/examples/Commune' schemas: + ListeDescendantsDepartement: + description: 'Liste des descendants d''un département. Les services geo/departement/{code}/precedents et geo/departement/{code}/projetes en héritent' + type: array + xml: + wrapped: true + name: Arrondissements + items: + $ref: '#/components/schemas/Arrondissement' + Arrondissement: + required: + - code + - uri + - type + - dateCreation + - intituleSansArticle + - typeArticle + - intitule + xml: + name: Arrondissement + properties: + code: + type: string + example: '674' + uri: + type: string + pattern: uri + xml: + attribute: true + example: 'http://id.insee.fr/geo/arrondissement/7f59df93-132b-400f-9aa6-b3c6be1018eb' + type: + type: string + example: 'Arrondissement' + dateCreation: + type: string + description: 'Date de création de l''arrondissement s''il n''existait pas au premier COG du 1er janvier 1943' + format: date + example: '2018-12-31' + xml: + name: DateCreation + intituleSansArticle: + xml: + name: IntituleSansArticle + type: string + example: 'Saverne' + typeArticle: + xml: + name: TypeArticle + type: string + enum: + - 0: + article: + charniere: 'De' + - 1: + article: + charniere: 'D''' + - 2: + article: 'Le' + charniere: 'Du' + - 3: + article: 'La' + charniere: 'De La' + - 4: + article: 'Les' + charniere: 'Des' + - 5: + article: 'L''' + charniere: 'De L''' + - 6: + article: 'Aux' + charniere: 'Des' + - 7: + article: 'Las' + charniere: 'De Las' + - 8: + article: 'Los' + charniere: 'De Los' + - X: + article: + charniere: + example: '0' + chefLieu: + type: string + example: '67437' + xml: + name: ChefLieu + intitule: + type: string + example: 'Saverne' + xml: + name: Intitule CodeCom: pattern: '[0-9][0-9AB][0-9]{3}' type: 'string' @@ -267,7 +527,7 @@ components: xml: attribute: true example: '22' - CommuneListe: + CommunesListe: description: 'Liste de communes' type: array xml: @@ -286,48 +546,54 @@ components: - Departement - Region example: 'Canton' - TerritoireBase: - type: object + TypeEnumInclusDansDepartement: + type: string + xml: + name: 'Type' + enum: + - Commune + - CommuneAssociee + - CommuneDeleguee + - Iris + - Arrondissement + - ArrondissementMunicipal + example: 'Arrondissement' + Departement: required: - code - uri + - type - dateCreation - intituleSansArticle - typeArticle + - chefLieu - intitule + xml: + name: Departement properties: - ###### Properties copied from TerritoireRef ! ######## code: + $ref: '#/components/schemas/CodeDep' + chefLieu: type: string - description: 'Code identifiant un teritoire quelqconque' - territoireType: - $ref: '#/components/schemas/TypeEnum' - ####################################################### uri: type: string pattern: uri xml: attribute: true - example: 'http://id.insee.fr/geo/commune/43018c68-c278-433a-b285-3531e8d5347e' + type: + xml: + name: type + type: string dateCreation: type: string description: 'Date de création du territoire s''il n''existait pas au premier COG du 1er janvier 1943' format: date - example: '2016-01-20' xml: name: DateCreation - dateSuppression: - type: string - description: 'Date de supression du territoire s''il a été supprimé' - format: date - example: '2016-01-20' - xml: - name: DateSuppression intituleSansArticle: xml: name: IntituleSansArticle type: string - example: 'Teste de Buch' typeArticle: xml: name: TypeArticle @@ -363,40 +629,25 @@ components: - X: article: charniere: - example: '3' intitule: type: string - example: 'La Teste de Buch' xml: name: Intitule - ListeTerritoires: - description: 'Liste de références sur des territoires' - type: array - xml: - wrapped: true - name: Territoires - items: - $ref: '#/components/schemas/TerritoireRef' - Departement: - xml: - name: Departement + ListeDepartementsWithDateSuppression: allOf: - - $ref: '#/components/schemas/TerritoireBase' - properties: - code: - $ref: '#/components/schemas/CodeDep' - chefLieu: - type: object + - $ref: '#/components/schemas/ListeDescendantsDepartement' + xml: + wrapped: true + name: Departement + - required: + - dateSuppression properties: - ###### Properties copied from TerritoireRef ! ######## - code: + dateSuppression: type: string - description: 'Code identifiant un teritoire quelconque' - territoireType: - $ref: '#/components/schemas/TypeEnum' - ####################################################### - xml: - name: ChefLieu + description: 'Date de suppression du territoire' + format: date + xml: + name: DateSuppression TerritoireRef: xml: name: TerritoireRef @@ -412,10 +663,74 @@ components: territoireType: $ref: '#/components/schemas/TypeEnum' Commune: + required: + - code + - uri + - type + - dateCreation + - intituleSansArticle + - typeArticle + - intitule xml: name: Commune - allOf: - - $ref: '#/components/schemas/TerritoireBase' properties: code: $ref: '#/components/schemas/CodeCom' + uri: + type: string + pattern: uri + xml: + attribute: true + type: + xml: + name: type + type: string + dateCreation: + type: string + description: 'Date de création de la commune si ell n''existait pas au premier COG du 1er janvier 1943' + format: date + xml: + name: DateCreation + intituleSansArticle: + xml: + name: IntituleSansArticle + type: string + typeArticle: + xml: + name: TypeArticle + type: string + enum: + - 0: + article: + charniere: 'De' + - 1: + article: + charniere: 'D''' + - 2: + article: 'Le' + charniere: 'Du' + - 3: + article: 'La' + charniere: 'De La' + - 4: + article: 'Les' + charniere: 'Des' + - 5: + article: 'L''' + charniere: 'De L''' + - 6: + article: 'Aux' + charniere: 'Des' + - 7: + article: 'Las' + charniere: 'De Las' + - 8: + article: 'Los' + charniere: 'De Los' + - X: + article: + charniere: + intitule: + type: string + xml: + name: Intitule