Shared assets / code / data used by more than one of the sibling apps in this
repository (site/, siade/, mocks/).
Each app is deployed in isolation: only its own subdirectory (e.g. site/) is
copied to the server. To make commons/ files available inside an app at
deploy time, two things are wired up:
-
Local development: each file a consumer app expects from
commons/is committed as a symlink at the path the app code reads. App code references the in-app path directly; the symlink resolves to the shared file in dev. -
Deployment: each consumer app contains an
.expandfile at its root listing the commons files that must be materialized inside the deploy build. Each non-comment line has the formsource:destinationwheresourceis a path relative to the repository root anddestinationis a path relative to the app's build directory. If:destinationis omitted,sourceis reused as the destination. The deployment script (seevery_ansible/roles/rails_app/templates/deploy_script.sh.j2) replaces each destination path (which is a symlink on disk) with a real copy of the source taken from the repository root.
Toutes les données d'un endpoint API (fiche métier + schéma swagger) sont regroupées ici. Structure :
commons/endpoints/
├── api_entreprise/ # Un fichier par endpoint (ou groupe de versions)
├── api_particulier/
├── _swagger_shared/ # Définitions swagger partagées entre plusieurs endpoints
│ # (paramètres SIREN/SIRET, identité pivot, schémas avec
│ # ancres YAML réutilisées). Accessibles via SwaggerData.get.
├── template.entreprise.yml.example
└── template.particulier.yml.example
Chaque fichier endpoint a le format suivant :
fiche:
- uid: 'provider/resource'
path: '/v3/provider/resource/{param}'
perimeter: ...
keywords: [...]
swagger:
provider.resource_name: # clé dottée = chemin SwaggerData.get
title: "Nom dans le swagger"
description: "..."
tags: ["Catégorie"]
attributes:
champ:
type: "string"
example: "valeur"fiche:— données métier (périmètre, FAQ, keywords…), lues parEndpointsStore(site)swagger:— schéma OpenAPI, lu parSwaggerData(siade). La clé dottée (provider.resource_name) correspond au chemin d'accèsSwaggerData.get('provider.resource_name.property')utilisé dans les specs rswag._swagger_shared/— définitions partagées entre plusieurs endpoints d'un même fournisseur (ancres YAML, paramètres communs). Ces fichiers sont aussi lus parSwaggerDataet servent de fallback/compléments aux swagger embarqués.
- Put it under
commons/(or anywhere at the repo root). - In each consuming app, commit a symlink at the path the code reads.
- Add a
source:destinationline in that app's.expandfile.