Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voeg naming-conventions toe aan standaard #158

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

TimvdLippe
Copy link
Contributor

De naming-conventions zijn ontwikkeld als onderdeel van
het kennisplatform APIs als aparte module. Deze commit
integreert de conventions in de standaard als rules
om overhead te voorkomen en alle rules verplicht te
maken (in tegenstelling tot een module die niet altijd
nodig is).

@TimvdLippe
Copy link
Contributor Author

@TimvdLippe TimvdLippe added Scope: Klein Kleine wijzigingen met beperkte scope Status: In bewerking Het voorstel is in bewerking bij de beheerorganisatie. Type: Wijziging Inhoudelijke wijziging op een standaard Overleg: TO-API Te agenderen voor het Technisch Overleg API labels Jan 17, 2025
@TimvdLippe TimvdLippe self-assigned this Jan 17, 2025
@TimvdLippe TimvdLippe requested a review from mrtn78 January 17, 2025 11:03
@TimvdLippe
Copy link
Contributor Author

@bwbroersma FYI dit is de wijziging wat betreft naming conventions

@bwbroersma
Copy link

bwbroersma commented Jan 21, 2025

@TimvdLippe: Is this for the current version 2.0.x that is in procedure at the Netherlands Standardisation Forum, or a later 2.1.x version?

BTW ^[a-z0-9]+([A-Z][a-z0-9]+)*$ does allow single letter first parts, but not single letter in later (uppercased) parts, so aLabel is allowed, while labelA is not. Maybe only a lower case first letter can be enforced, so e.g. ^[a-z0-9]+[A-Za-z0-9]*$.

@TimvdLippe
Copy link
Contributor Author

@bwbroersma This is for a future version of ADR, unrelated to the ongoing 2.0.x procedure.

Yes good point. I wanted to be clear about multiple consecutive uppercase characters which aren't allowed in camelCase. I updated the regex to handle that edge case. You can test it out here: https://regex101.com/r/7nmJmc/2

@bwbroersma
Copy link

bwbroersma commented Jan 21, 2025

Unrelated to the ongoing 2.0.x procedure.

Great!

Counter example of the new regex ^[a-z0-9]+([A-Z][a-z0-9]+)*([A-Z])?$ is labelACount, single letter parts are allowed at the start and end, but not in the middle (you can think of 'A' of energy efficiency, nutrition, letter grading, etc.).

@TimvdLippe
Copy link
Contributor Author

De huidige linter (toegevoegd in #174) vereist kebab-case al voor paths. Voor query keys kunnen we nog een validatie schrijven. De afkortingen regel is niet te automatiseren helaas, maar zou manueel moeten worden gecheckt.

De naming-conventions zijn ontwikkeld als onderdeel van
het kennisplatform APIs als aparte module. Deze commit
integreert de conventions in de standaard als rules
om overhead te voorkomen en alle rules verplicht te
maken (in tegenstelling tot een module die niet altijd
nodig is).

Paths moeten kebab-case zijn, wat al door de linter
werd geenforceerd en standaard is in OpenAPI
specificaties. Queries daarentegen moeten camelCase
zijn, wat ook standaard is in OpenAPI specificaties.

Hiermee zorgen we er ook voor dat een API
wel een standaard afkorting mag gebruiken,
maar dat ook voor een leek duidelijk is op
basis van de documentatie waar die afkorting
voor staat.
@TimvdLippe TimvdLippe force-pushed the pr/timvdlippe/naming-conventions branch from 76702a3 to b0d0199 Compare March 5, 2025 12:05
Copy link

github-actions bot commented Mar 5, 2025

@TimvdLippe TimvdLippe requested a review from sanderke March 5, 2025 12:07
@TimvdLippe TimvdLippe added Status: Ter goedkeuring Het voorstel is uitgewerkt en wordt ter goedkeuring aangeboden. and removed Status: In bewerking Het voorstel is in bewerking bij de beheerorganisatie. labels Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Overleg: TO-API Te agenderen voor het Technisch Overleg API Scope: Klein Kleine wijzigingen met beperkte scope Status: Ter goedkeuring Het voorstel is uitgewerkt en wordt ter goedkeuring aangeboden. Type: Wijziging Inhoudelijke wijziging op een standaard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants