You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+59-11
Original file line number
Diff line number
Diff line change
@@ -11,18 +11,65 @@ See OpenAPI specification `postman/schemas/index.yaml`. To view locally in Swagg
11
11
- nvm - [nvm](https://github.com/nvm-sh/nvm) - Node version manager
12
12
- Node LTS
13
13
- once you've installed nvm run `nvm use` which will look at `.nvmrc` for the node version, if it's not installed then it will prompt you to install it with `nvm install <version>`
- There are two ways to run this locally: directly, or using the `docker compose` setup. The docker build includes the `xmllint` tool. If you run it directly, you may need to install this tool.
20
+
- On Ubuntu it is in `libxml2-utils`, so you'll need something like `sudo apt install libxml2-utils`.
18
21
19
22
## Getting Started
20
23
21
24
1. Clone this repository
22
25
1. Follow instructions for nvm/node prerequisties above
23
-
1. Run `npm i` to install dependencies
26
+
1. Setup the environment variables using the `.env` file (instructions below)
27
+
* If running directly (option 1), this will mean setting up a `redis` database.
28
+
29
+
### Option 1: running directly
30
+
31
+
4. Run `npm i` to install dependencies
24
32
1. Run `npm start` to run the Function locally using the Azure Functions Core Tools
25
-
1. Run `npm run docker:start` to run the Function inside a Docker container using docker-compose.yml to create a Redis instance.
33
+
1. The API end points will be available on `localhost:7071`
34
+
35
+
### Option 2: using docker
36
+
37
+
4. Run `npm run docker:start` to run the Function inside a Docker container using docker-compose.yml to create a Redis instance.
38
+
1. The API end points will be available on `localhost:8080`
39
+
40
+
41
+
### Test setup
42
+
43
+
To test the basic setup, you can run the following command:
44
+
45
+
`curl http://localhost:8080/api/pub/version`
46
+
47
+
This should return a version number (change port if running directly instead of via docker).
48
+
49
+
To test the validation is working, obtain an IATI XML file, and run the following command (this is if running via the docker setup; change port to `7071` if running directly):
50
+
51
+
`curl -X POST -d @PATH_TO_IATI_XML http://localhost:8080/api/pub/validate`
52
+
53
+
You should see something like (if the file is a valid IATI file):
- GitHub PAT token to authenticate to the GitHub API to pull in some external resources from GitHub
88
+
- GitHub personal access token. This is needed to pull in the Codelists from the `IATI/IATI-Validator-Codelists` repository. Note that you cannot use a "Personal Access Token (Classic)"; you must generate a fine-grained access token.
42
89
43
-
REDIS_CACHE_SEC=60
44
-
REDIS_PORT=6379
45
-
REDIS_KEY=
90
+
REDIS_CACHE_SEC=60
91
+
REDIS_PORT=6379
92
+
REDIS_KEY=
46
93
REDIS_HOSTNAME=
47
94
48
95
- Redis connection, leaving the default will connect to a locally installed instance if you have one.
- URL and API Key for Validator Services, used to get list of Publisher Identifiers
55
102
56
-
### config defaults
103
+
### App config defaults (set in `config/config.js`)
57
104
58
105
```
59
106
`APP_NAME`: IATI Validator API
@@ -192,4 +239,5 @@ These are sourced from the following locations:
192
239
Due to a [known limitation](https://gitlab.gnome.org/GNOME/libxml2/-/issues/361) in the core library `libxml2` used to perform schema validation, if an activity has a schema error at a line greater than 65535, the value will not be accurate in the context.
193
240
194
241
If this is the case for your validation report, a message like so will be displayed in the context of the schema error:
195
-
`At line greater than: 65537. Note: The validator cannot display accurate line numbers for schema errors located at a line greater than 65537 for this activity.`
242
+
243
+
At line greater than: 65537. Note: The validator cannot display accurate line numbers for schema errors located at a line greater than 65537 for this activity.
0 commit comments