eq-publisher-v3
A new version of eq-publisher
for translating questionnaires built in Author into Runner V3 format. When finished, this project will replace eq-publisher
within the eq-author-app
repository.
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. There are no deployment steps as this project is in development.
Prerequisites
eq-author-app
is currently supports NodeJS version 10 and prior, therefore this application does the same. To swap to version 10, run nvm install 10 && nvm use 10
in the terminal, beneath the eq-publisher-v3
directory.
Installing
- Clone the repository
- Run
yarn
to install the dependencies - Run
yarn start
to boot up the application
Development
Testing whether a converted schema is returned relies on passing author json to eq-publisher-v3
.
It may be easier to set up an endpoint collection in Postman to view the converted schema.
If validating a schema during development envrionment variable EQ_VALIDATOR_URL
is needed.
When the validator URL is set, it is possible to hit the /publish/validate
endpoint for more detailed error messages.
Run yarn develop
to start the application with Nodemon. Nodemon automatically refreshes the application when source files change, making development easy.
Running the tests
Run yarn test
to kick-start the unit tests. Our unit tests are written in Jest, which allows a variety of flags to be passed along with the start command; you may use these at your leisure.
Run yarn test
to run Jest on file changes.
We do not currently have end-to-end tests.
Coding style tests
Run yarn lint
to examine the code for any common styling issues. We do this to ensure we write quality and consistent code.
Deployment
There are no deployment steps as this application is currently in development.
API Reference
Method | Endpoint | Description |
---|---|---|
POST | /publish |
Convert author JSON into Eq/Runner JSON |
POST | /publish/validate |
Validates converted JSON with a schema validator |
Publish
Converts author JSON to Eq/Runner V3 and returns the result
-
URL
/publish
-
Method:
POST
-
Body Params
{ author questionnaire }
-
Success Response:
Code: 200
Example: Runner JSON; examples: https://github.com/ONSdigital/eq-questionnaire-runner/blob/master/test_schemas/en/ecommerce.json -
Fail Responses:
Code: 400
Validate Publish
Validates converted questionnaire against schema
-
URL
/publish/validate
-
Method:
POST
-
Body Params
{ author questionnaire }
-
Success Response:
Code: 200
Example: Runner JSON; examples: https://github.com/ONSdigital/eq-questionnaire-runner/blob/master/test_schemas/en/ecommerce.json -
Fail Responses:
Code: 400
Example:{ "valid": false, "errors": { "message": "Additional properties are not allowed ('hub' was unexpected)", "path": "deque([])", "predicted_cause": "Additional properties are not allowed ('hub' was unexpected)" } }