Skip to content
Snippets Groups Projects

MetExplore 3 Api

You have just to edit the yaml files and push to master to launch ci jobs that will create doc and npm package.

The following sections explain the different actions done in CI if you want to test them before pushing your code.

The last sections explain how to access the yaml file via npm.

Install

npm install

Validation

npm run validate

Merge Yaml file

npm run build

Create a new yaml file in the build directory.

Validation of the bundle file

npm run validate-build

Automatically done in CI.

Documentation generation

Need the bundle file built with 'npm run build'.

npm run generate-doc

Automatically done in CI and available in https://metexplore.pages.mia.inra.fr/metexplore-api/metexplore3-api-specs/ .

Change version

Major version (X.y.z):

npm run update-version major

Minor version (x.Y.z):

npm run update-version minor

Patch version (x.y.Z):

npm run update-version patch

To a specific version:

npm run update-version 0.6.0

The command "npm run update-version" changes both package.json and metexplore3-api.yml files.

Npm publish

Automatically done in CI. Published on https://forgemia.inra.fr/metexplore/metexplore-api/metexplore3-api-specs/-/packages

How to import yaml file from npm

Create a .npmrc file:

@metexplore:registry=https://forgemia.inra.fr/api/v4/packages/npm/
//forgemia.inra.fr/api/v4/packages/npm/:_authToken=${CI_JOB_TOKEN}

Install the npm module:

export CI_JOB_TOKEN=cBZySZds******
npm install --save @metexplore/metexplore3-api-specs

Use it in your code:

const yamlFile = 'node_modules/@metexplore/metexplore3-api-specs/build/metexplore3-api.yml';