Bump Version
Create a new version of an API endpoint fiche while preserving the previous version as legacy.
Workflow
Identify the source fiche — Read the current YAML file in
config/endpoints/api_entreprise/orconfig/endpoints/api_particulier/.Understand the changes — Ask the user for a PR or issue URL as référence (e.g. siade PR, Linear issue). Read it to understand what the new version adds/modifies. Reference it in the commit message.
Apply the pattern — See references/pattern.md for the full before/after structure. In short:
- The main entry keeps its
uid, gets the bumpedpath(e.g./vN/...), a newhistorique,new_version: true, and YAML anchors on all shared fields. - A new legacy entry is added with
uidsuffixed_vN-1,new_endpoint_uidspointing to main,position + 1, and YAML aliases for shared fields.
- The main entry keeps its
Validate — Run the relevant endpoint spec:
bundle exec rspec spec/models/api_entreprise/endpoint_spec.rb bundle exec rspec spec/models/api_particulier/endpoint_spec.rbVerify loading — Confirm both entries load:
bundle exec rails runner " klass = APIParticulier::Endpoint # or APIEntreprise::Endpoint klass.all.select { |e| e.uid.include?('provider') }.each { |e| puts e.uid } "
Important
- Always add
new_version: trueon the main (vN) entry to tag it as a new version (see commit6db066885a). - Never change the main
uid— it ensures continuity for consumers. - Always preserve the original
historiqueon the legacy entry. - Anchor naming convention: short provider/resource prefix (e.g.
&cnous_,&insee_etablissements_). - Reference commit:
65f338cc47ea00518687842714a65cf4aadf81bb.