Skip to content

Commit

Permalink
Fix merge after #505 and #506
Browse files Browse the repository at this point in the history
  • Loading branch information
James McKinney committed Jul 24, 2017
2 parents 1f65702 + 1094f24 commit d6d9d71
Show file tree
Hide file tree
Showing 21 changed files with 89 additions and 271 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Expand Up @@ -2,6 +2,10 @@ sudo: false
language: python
python:
- "3.5"
addons:
apt:
packages:
- lftp
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
install: pip install -r requirements.txt
# command to run tests, e.g. python setup.py test
Expand Down
3 changes: 0 additions & 3 deletions build_docs.sh
@@ -1,8 +1,6 @@
#!/bin/bash
set -e
mkdir -p standard/docs/field_definitions
cd standard
python schema/utils/make_field_definitions.py
CODELIST_LANG=en python schema/utils/translate_codelists.py schema
CODELIST_LANG=en python schema/utils/translate_codelists.py docs/en/extensions

Expand All @@ -28,7 +26,6 @@ python standard/schema/utils/translate_schema.py es fr

cd standard
for lang in es fr; do
SCHEMA_LANG=$lang python schema/utils/make_field_definitions.py
CODELIST_LANG=$lang python schema/utils/translate_codelists.py schema
CODELIST_LANG=$lang python schema/utils/translate_codelists.py docs/en/extensions
# Create a symlink for the current language, so we can reference the
Expand Down
2 changes: 0 additions & 2 deletions standard/.babel_schema
@@ -1,5 +1,3 @@
[python: schema/utils/make_field_definitions.py]

[jsonschema_text: schema/*.json]


4 changes: 2 additions & 2 deletions standard/docs/en/schema/record_package.md
Expand Up @@ -2,9 +2,9 @@

The record package schema describes the container structure for publishing records. The contents of a record are based on the release schema. The package contains important meta-data.

You can view an interactive version of the record schema below (requires javascript) or [download this version of the schema here](../../../record-package-schema.json).
You can view an interactive version of the record schema below (requires javascript) or [download this version of the schema here](../../../../record-package-schema.json).

A separate, auto-generated, [versioned release validation schema](../../../versioned-release-validation-schema.json) is provided for validating releases within fully versioned records.
A separate, auto-generated, [versioned release validation schema](../../../../versioned-release-validation-schema.json) is provided for validating releases within fully versioned records.

Click on schema elements to expand the tree, or use the '+' icon to expand all elements. Use { } to view the underlying schema for any section.

Expand Down
2 changes: 1 addition & 1 deletion standard/docs/en/schema/release.md
@@ -1,6 +1,6 @@
# Release Schema

The release schema provides the authoritative definition of fields and their structure. You can view an interactive version of the release schema below (requires javascript) or [download this version of the schema here](../../../release-schema.json).
The release schema provides the authoritative definition of fields and their structure. You can view an interactive version of the release schema below (requires javascript) or [download this version of the schema here](../../../../release-schema.json).

The release schema is used to validate the contents of the ```releases``` array of [release packages](release_package.md), and the ```compiledReleases``` array of releases in a [record package](record_package.md).

Expand Down
2 changes: 1 addition & 1 deletion standard/docs/en/schema/release_package.md
Expand Up @@ -2,7 +2,7 @@

The release package schema describes the container document for publishing releases. The package contains important meta-data.

You can view an interactive version of the release schema below (requires javascript) or [download this version of the schema here](../../../release-package-schema.json).
You can view an interactive version of the release schema below (requires javascript) or [download this version of the schema here](../../../../release-package-schema.json).

Click on schema elements to expand the tree, or use the '+' icon to expand all elements. Use { } to view the underlying schema for any section.

Expand Down
6 changes: 5 additions & 1 deletion standard/schema/tests/test_schema_integrity.py
@@ -1,3 +1,7 @@
"""
Ensures that `make_validation_schema.py` has been run.
"""

import json

from .test_validate_schema import (
Expand All @@ -9,7 +13,7 @@


def test_versioned_release_validation_schema_is_in_sync():
# Builds the validation schema and confirms its equal to the stored schema
# Builds the validation schema and confirms it's equal to the stored schema
with open(VERSIONED_RELEASE_VALIDATION_SCHEMA_PATH, "r") as f:
actual = json.loads(f.read())

Expand Down
4 changes: 4 additions & 0 deletions standard/schema/tests/test_validate_packages.py
@@ -1,3 +1,7 @@
"""
Ensures that sample data validates correctly.
"""

import requests
import requests_mock
import pytest
Expand Down
6 changes: 6 additions & 0 deletions standard/schema/tests/test_validate_schema.py
@@ -1,4 +1,10 @@
#!/usr/bin/env python
"""
Validates release package, record package, release, and versioned release
schemas against JSON Schema Draft 4, and ensures that the JSON contains no
duplicate keys.
"""

import json
from path import path
from jsonschema import validate
Expand Down
22 changes: 0 additions & 22 deletions standard/schema/utils/README.md
Expand Up @@ -14,26 +14,4 @@ This can be created by running:

There are tests set-up to ensure this has happened.

### make_field_definitions.py

In order to display flattened version of the schema (primarily for the tables on the reference page of the documentation) we generate a set of field definition CSV files.

make_field_definition.py manually specifies each of the files to be generated.

````
python make_field_definition.py
````

should be run whenever the schema is updated so that the documentation reflects changes in field names, structures and descriptions.

### get_codelists.py

At present, codelist contents is managed through a Google Spreadsheet.

The get_codelists.py script fetches each codelist, and stores it in the /schema/codelists directory as a CSV file. It also fetches the IATI Organisation Identifier codelist.

````
python get_codelists.py
````

should be run whenever codelists are changed.
4 changes: 4 additions & 0 deletions standard/schema/utils/codelists_extract.py
@@ -1,3 +1,7 @@
"""
Babel extractor used in setup.py
"""

import csv
import io

Expand Down
52 changes: 0 additions & 52 deletions standard/schema/utils/get_codelists.py

This file was deleted.

4 changes: 4 additions & 0 deletions standard/schema/utils/jsonschema_extract.py
@@ -1,3 +1,7 @@
"""
Babel extractor used in setup.py
"""

import json


Expand Down
186 changes: 0 additions & 186 deletions standard/schema/utils/make_field_definitions.py

This file was deleted.

5 changes: 5 additions & 0 deletions standard/schema/utils/make_validation_schema.py
@@ -1,4 +1,9 @@
#!/usr/bin/env python

"""
See README for this script's documentation.
"""

import json
from collections import OrderedDict
import copy
Expand Down
4 changes: 4 additions & 0 deletions standard/schema/utils/reformat_schema.py
@@ -1,3 +1,7 @@
"""
Makes whitespace consistent in release-schema.json.
"""

import json
from collections import OrderedDict
from os.path import abspath, dirname, join
Expand Down

0 comments on commit d6d9d71

Please sign in to comment.