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

replace yaml by js #6

Open
maxlath opened this issue May 5, 2021 · 0 comments
Open

replace yaml by js #6

maxlath opened this issue May 5, 2021 · 0 comments

Comments

@maxlath
Copy link
Member

maxlath commented May 5, 2021

The end product of all those yaml files is a big json file, so using yaml isn't a hard requirement, and yet another syntax to learn (the only other place where we use yaml in inventaire is docker compose files).

Replacing yaml by js would have in particular the following advantages:

  • JS capabilities would make some files easier to maintain. For example, this line:
  x-example: "{\n  \"entries\": [\n    {\n      \"edition\": [\n        {\n          \"isbn\": \"979-10-209-0050-0\",\n          \"claims\": {\n            \"wdt:P1476\": \"Aimer à en perdre la raison\",\n            \"wdt:P123\": \"wd:Q3236382\",\n            \"wdt:P577\": \"2013-03-20\"\n          },\n          \"image\": \"http://www.editionslesliensquiliberent.fr/images/livre_affiche_355.png\"\n        }\n      ],\n      \"works\": [\n        {\n          \"labels\": {\n            \"fr\": \"Aimer à en perdre la raison\"\n          }\n        }\n      ],\n      \"authors\": [\n        {\n          \"labels\": {\n            \"fr\": \"Maryse Vaillant\"\n          }\n        }\n      ]\n    }\n  ]\n}"

could become

  'x-example': JSON.stringify({
  entries: [
    {
      edition: [
        {
          isbn: '979-10-209-0050-0',
          claims: {
            'wdt:P1476': 'Aimer à en perdre la raison',
            'wdt:P123': 'wd:Q3236382',
            'wdt:P577': '2013-03-20'
          },
          image: 'http://www.editionslesliensquiliberent.fr/images/livre_affiche_355.png'
        }
      ],
      works: [ { labels: { fr: 'Aimer à en perdre la raison' } } ],
      authors: [ { labels: { fr: 'Maryse Vaillant' } } ]
    }
  ]
})

much easier to read and edit.

  • use the familiar CommonJS require instead of yaml $ref

This could also open the possibility to build or assist the maintenance of this documentation by using the server code, for instance if we were to export controllers sanitization objects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant