Skip to content

Commit

Permalink
add recipe for WCMP2 validation (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis authored Oct 25, 2024
1 parent 27d545d commit 82f5c64
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/cookbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ jobs:
uses: actions/checkout@v3
- name: build documentation
run: |
cd cookbook \
mkdir -p /tmp/wis2-cookbook/cookbook/images \
&& cd cookbook \
&& asciidoctor --trace -o /tmp/wis2-cookbook/cookbook/${FILE_BASENAME}.html index.adoc \
&& asciidoctor -a allow-uri-read --trace --backend docbook --out-file - index.adoc | pandoc --from docbook --to docx --output /tmp/wis2-cookbook/cookbook/${FILE_BASENAME}.docx \
&& asciidoctor -a allow-uri-read --trace -r asciidoctor-pdf --trace -b pdf -o /tmp/wis2-cookbook/cookbook/${FILE_BASENAME}.pdf index.adoc \
&& cp images/*.png /tmp/wis2-cookbook/cookbook/images \
&& cd ..
- name: checkout gh-pages branch
uses: actions/checkout@v3
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test-cookbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
uses: actions/checkout@v3
- name: build documentation
run: |
cd cookbook \
mkdir -p /tmp/wis2-cookbook/cookbook/images \
&& cd cookbook \
&& asciidoctor --trace -o /tmp/wis2-cookbook/cookbook/${FILE_BASENAME}.html index.adoc \
&& asciidoctor -a allow-uri-read --trace --backend docbook --out-file - index.adoc | pandoc --from docbook --to docx --output /tmp/wis2-cookbook/cookbook/${FILE_BASENAME}.docx \
&& asciidoctor -a allow-uri-read --trace -r asciidoctor-pdf --trace -b pdf -o /tmp/wis2-cookbook/cookbook/${FILE_BASENAME}.pdf index.adoc
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions cookbook/sections/data-publishers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,43 @@ Note:
* only properties defined in the OpenAPI Security Scheme defintion are allowed. Any additional properties will invalidate the WNM

Of course, always ensure your WNM is valid (see <<Validate a WIS2 Notification Message>> for more information).

=== Validate a WMO Core Metadata Profile record

The [pywcmp](https://github.com/wmo-im/pywcmp) tool provides a test suite to validate a message against the WCMP2 specification requirements, as well as a Python API for application integration. Consult the pywcmp README on GitHub for more information/examples.

.Using pywcmp
[source,bash]
----
# install pywcmp
pip3 install pywcmp
# sync WCMP2 schemas and codelists
pywis-pubsub bundle sync
# validate WCMP2 against abstract test suite (file on disk)
pywcmp ets validate /path/to/file.json
# validate WCMP2 against abstract test suite (URL)
pywcmp ets validate https://example.org/path/to/file.json
----

A WCMP2 record can also be validated using pywcmp "as a service" using the Canadian WIS2 Global Discovery Catalogue, which provides an online validator:

- Navigate to https://wis2-gdc.weather.gc.ca/openapi?f=html
- Navigate to section *pywcmp-wis2-wcmp2-ets*, endpoint `/processes/pywcmp-wis2-wcmp2-ets/execution` (POST)
- Click "Try it out"
- In the section "Mandatory execute request JSON", paste the WCMP2 JSON inside the `record` object

.WIS2 GDC online validator, request
image::images/data-publishers-wcmp2-validate-request.png[WIS2 GDC online validator, request]

- Click "Execute"

.WIS2 GDC online validator, response
image::images/data-publishers-wcmp2-validate-response.png[WIS2 GDC online validator, response]

A response will be provided with validation results.



0 comments on commit 82f5c64

Please sign in to comment.