onaio / fhir-tooling

A command line utility to support FHIR Core content authoring
Other
2 stars 1 forks source link

Validate file structure #84

Closed Wambere closed 8 months ago

Wambere commented 8 months ago

IMPORTANT: Where possible all PRs must be linked to a Github issue

Fixes https://github.com/onaio/fhir-tooling/issues/21

Engineer Checklist

Wambere commented 8 months ago

Here is an initial draft sample JSON schema for the proposed file structure

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "http://example.com/schemas/project-structure-schema.json",
    "title": "Project",
    "description": "Project structure",
    "type": "object",
    "properties": {
        "projectName": {
            "type": "array",
            "items": {
                "type": "object",
                "allOf": [
                    { "$ref": "#/$defs/apps" },
                    { "$ref": "#/$defs/packages" }
                ]
            },
            "minItems": 2,
            "maxItems": 2
        }
    },
    "$defs": {
        "apps": {
            "type": "array",
            "items": {
                "type": ["object", "string"],
                "properties": {
                    "profiles": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "pattern": "._config.json$"
                        }
                    },
                    "registers": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "pattern": "._config.json$"
                        }
                    },
                    "translations": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "pattern": "._config.properties$"
                        }
                    }
                }
            }
        },
        "packages": {
            "type": "array",
            "items": {
                "type": ["object"],
                "properties": {
                    "library": {
                        "type": "array"
                    },
                    "plan_definitions": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "pattern": ".json$"
                        }
                    },
                    "structure_maps": {
                        "type": "array"
                    },
                    "questionnaires": {
                        "type": "array",
                        "pattern": ".json$"
                    },
                    "translations": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "pattern": ".properties$"
                        }
                    }
                }
            }
        }
    }
  }