Skip to content

Commit 0b3728f

Browse files
added to docs data.
1 parent 82dbef9 commit 0b3728f

File tree

11 files changed

+1168
-50
lines changed

11 files changed

+1168
-50
lines changed

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ vendor
88
node_modules
99
_config.version.yml
1010
schemas
11+
_data/schema

docs/Makefile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ BASE_URL ?= "/"
22
VERSION ?= ""
33
SCHEMA_PATTERN = *.schema.json
44
SCHEMA_DOCS_PATTERN = *.md
5+
SCHEMA_YAML_DOCS_PATTERN= *.yaml
56
SCHEMA_BASE_INPUT_DIR = ../schemas
6-
SCHEMA_INPUT_DIR = $(SCHEMA_BASE_INPUT_DIR)/output
7-
SCHEMA_DOCS_INPUT_DIR = $(SCHEMA_BASE_INPUT_DIR)/docs
7+
SCHEMA_INPUT_DIR = $(SCHEMA_BASE_INPUT_DIR)/output/schemas
8+
SCHEMA_DOCS_INPUT_DIR = $(SCHEMA_BASE_INPUT_DIR)/output/docs/md
9+
SCHEMA_YAML_DOCS_INPUT_DIR = $(SCHEMA_BASE_INPUT_DIR)/output/docs/yaml
810
BASE_OUTPUT_DIR = _site
911
BASE_DOCS_OUTPUT_DIR = schemas
1012
SCHEMA_OUTPUT_DIR = $(BASE_OUTPUT_DIR)/schemas
1113
SCHEMA_DOCS_OUTPUT_DIR = $(BASE_DOCS_OUTPUT_DIR)
12-
14+
SCHEMA_YAML_DOCS_OUTPUT_DIR = _data/schema
1315
SHELL = /bin/bash
1416

1517
default: install
@@ -29,7 +31,7 @@ define baseurlparam =
2931
$(if $(BASE_URL),-- --baseurl $(BASE_URL),-- --baseurl "")
3032
endef
3133

32-
build: build-schemas copy-schema-docs build-docs copy-schemas show-build-output
34+
build: build-schemas copy-schema-docs copy-schema-yaml-docs build-docs copy-schemas show-build-output
3335

3436
build-docs: version
3537
npm run build $(baseurlparam)
@@ -48,6 +50,15 @@ copy-schema-docs:
4850
@find $(SCHEMA_DOCS_OUTPUT_DIR) -type f -name "*" | sort
4951

5052

53+
copy-schema-yaml-docs:
54+
mkdir -p $(SCHEMA_YAML_DOCS_OUTPUT_DIR)
55+
@echo "Finding schema YAML docs files..."
56+
@find $(SCHEMA_YAML_DOCS_INPUT_DIR) -name "$(SCHEMA_YAML_DOCS_PATTERN)" -print
57+
@echo "Copying schema YAML docs files..."
58+
rsync -av --include="*/" --include="$(SCHEMA_YAML_DOCS_PATTERN)" --exclude="*" $(SCHEMA_YAML_DOCS_INPUT_DIR)/ $(SCHEMA_YAML_DOCS_OUTPUT_DIR)/
59+
@echo "Output in $(SCHEMA_YAML_DOCS_OUTPUT_DIR):"
60+
@find $(SCHEMA_YAML_DOCS_OUTPUT_DIR) -type f -name "*" | sort
61+
5162
copy-schemas:
5263
mkdir -p $(SCHEMA_OUTPUT_DIR)
5364
@echo "Finding schema files..."
@@ -69,6 +80,7 @@ clean-docs:
6980
clean-schemas:
7081
rm -rf $(SCHEMA_OUTPUT_DIR)
7182
rm -rf $(SCHEMA_DOCS_OUTPUT_DIR)
83+
rm -rf $(SCHEMA_YAML_DOCS_OUTPUT_DIR)
7284

7385
debug: version
7486
npm run debug

docs/_config.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ collections:
3232
output: true
3333
sort_by: order
3434

35+
3536
# Build settings
3637
theme: just-the-docs
3738
plugins:
@@ -86,6 +87,7 @@ callouts:
8687
color: blue
8788

8889

90+
8991
defaults:
9092
- scope:
9193
path: "schemas"
@@ -98,6 +100,15 @@ defaults:
98100
owner: NHS Notify
99101
author: NHS Notify
100102
last_modified_date: 2025-01-01
103+
- scope:
104+
path: ""
105+
type: "schema"
106+
values:
107+
layout: "page"
108+
is_not_draft: false
109+
owner: NHS Notify
110+
author: NHS Notify
111+
last_modified_date: 2025-01-01
101112

102113
# Exclude from processing.
103114
# The following items will not be processed, by default.

docs/collections/_notify-repos/nhs-notify-repository-template.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

schemas/Makefile

Lines changed: 59 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
# Variables
22
SCHEMA_SRC_DIR := src
33
OUTPUT_DIR := output
4-
DOCS_DIR := docs
4+
DOCS_OUTPUT_DIR := $(OUTPUT_DIR)/docs
5+
SCHEMAS_OUTPUT_DIR := $(OUTPUT_DIR)/schemas
56
SCRIPTS_DIR := scripts
67
YAML_TO_JSON_SCRIPT := $(SCRIPTS_DIR)/yaml_to_json.py
78
GENERATE_DOCS_SCRIPT := $(SCRIPTS_DIR)/generate_docs.py
9+
GENERATE_DOCS_ALL_SCRIPT := $(SCRIPTS_DIR)/generate_docs_all.py
10+
GENERATE_DOCS_YAML_SCRIPT := $(SCRIPTS_DIR)/generate_docs_yaml.py
11+
GENERATE_DOCS_MD_SCRIPT := $(SCRIPTS_DIR)/generate_docs_markdown.py
812
YAML_SCHEMAS := $(shell find $(SCHEMA_SRC_DIR) -name "*.schema.yaml" -type f)
913
JSON_OUTPUTS := $(patsubst $(SCHEMA_SRC_DIR)/%.schema.yaml,$(OUTPUT_DIR)/%.schema.json,$(YAML_SCHEMAS))
1014

1115
# Default target
12-
.PHONY: all clean build build-schemas convert-schemas config check-deps build-docs
16+
.PHONY: all clean build build-schemas convert-schemas config check-deps build-docs build-docs-yaml build-docs-md build-docs-legacy
1317

1418
all: build
1519

@@ -32,56 +36,87 @@ check-deps:
3236
@python3 -c "import yaml" 2>/dev/null || \
3337
(echo "PyYAML not found. Run 'make config' to install dependencies." && exit 1)
3438

35-
# Convert all YAML schemas to JSON
39+
# Convert all YAML schemas to JSON (standalone - puts JSON files in schemas subdirectory)
3640
convert-schemas: check-deps $(OUTPUT_DIR)
3741
@echo "Converting YAML schemas to JSON..."
42+
@mkdir -p "$(SCHEMAS_OUTPUT_DIR)"
3843
@for yaml_file in $(YAML_SCHEMAS); do \
3944
relative_path=$${yaml_file#$(SCHEMA_SRC_DIR)/}; \
40-
output_file="$(OUTPUT_DIR)/$${relative_path%.schema.yaml}.schema.json"; \
45+
output_file="$(SCHEMAS_OUTPUT_DIR)/$${relative_path%.schema.yaml}.schema.json"; \
4146
output_dir=$$(dirname "$$output_file"); \
4247
mkdir -p "$$output_dir"; \
4348
echo "Converting $$yaml_file to $$output_file"; \
4449
python3 $(YAML_TO_JSON_SCRIPT) "$$yaml_file" "$$output_file"; \
4550
done
4651

47-
# Build all schemas
52+
# Build all schemas (standalone - just JSON conversion)
4853
build-schemas: convert-schemas
4954
@echo "Building schemas complete!"
5055
@echo "Found $(words $(YAML_SCHEMAS)) YAML schema(s):"
5156
@for schema in $(YAML_SCHEMAS); do echo " - $$schema"; done
52-
@echo "Generated JSON schemas in $(OUTPUT_DIR)/"
57+
@echo "Generated JSON schemas in $(SCHEMAS_OUTPUT_DIR)/"
5358

5459
# Build everything (schemas and docs)
55-
build: build-schemas build-docs
56-
@echo "Build complete! Generated JSON schemas and documentation."
60+
build: build-docs
61+
@echo "Build complete! Generated JSON schemas and documentation in $(OUTPUT_DIR)/"
5762

58-
# Generate documentation from schemas
63+
# Generate documentation from schemas (new two-stage approach)
64+
# This now includes JSON schema conversion as part of the documentation package
5965
build-docs: check-deps
60-
@echo "Generating documentation from YAML schemas..."
61-
@python3 $(GENERATE_DOCS_SCRIPT) $(SCHEMA_SRC_DIR) $(DOCS_DIR)
62-
@echo "Documentation generated in $(DOCS_DIR)/"
66+
@echo "Generating complete documentation package from YAML schemas..."
67+
@python3 $(GENERATE_DOCS_ALL_SCRIPT) $(SCHEMA_SRC_DIR) $(OUTPUT_DIR)
68+
@echo "Documentation package generated in $(OUTPUT_DIR)/"
69+
@echo " - JSON Schemas: $(SCHEMAS_OUTPUT_DIR)/"
70+
@echo " - YAML docs: $(DOCS_OUTPUT_DIR)/yaml/"
71+
@echo " - Markdown docs: $(DOCS_OUTPUT_DIR)/md/"
72+
73+
# Generate only YAML documentation (for tool consumption)
74+
build-docs-yaml: check-deps
75+
@echo "Generating YAML documentation from schemas..."
76+
@python3 $(GENERATE_DOCS_YAML_SCRIPT) $(SCHEMA_SRC_DIR) $(DOCS_OUTPUT_DIR)/yaml
77+
@echo "YAML documentation generated in $(DOCS_OUTPUT_DIR)/yaml/"
78+
79+
# Generate only Markdown documentation (from existing YAML docs)
80+
build-docs-md: check-deps
81+
@echo "Generating Markdown documentation from YAML docs..."
82+
@test -d "$(DOCS_OUTPUT_DIR)/yaml" || (echo "Error: YAML docs not found. Run 'make build-docs-yaml' first." && exit 1)
83+
@python3 $(GENERATE_DOCS_MD_SCRIPT) $(DOCS_OUTPUT_DIR)/yaml $(DOCS_OUTPUT_DIR)/md
84+
@echo "Markdown documentation generated in $(DOCS_OUTPUT_DIR)/md/"
85+
86+
# Generate documentation using legacy single-stage approach
87+
build-docs-legacy: check-deps
88+
@echo "Generating documentation using legacy approach..."
89+
@python3 $(GENERATE_DOCS_SCRIPT) $(SCHEMA_SRC_DIR) docs_legacy
90+
@echo "Legacy documentation generated in docs_legacy/"
6391

6492
# Clean output directory
6593
clean:
66-
@echo "Cleaning output and docs directories..."
67-
@rm -rf $(OUTPUT_DIR) $(DOCS_DIR)
94+
@echo "Cleaning output directories..."
95+
@rm -rf $(OUTPUT_DIR) docs_legacy
6896
@echo "Clean complete!"
6997

7098
# Show help
7199
help:
72100
@echo "Available targets:"
73-
@echo " all - Build everything (schemas + docs) (default)"
74-
@echo " build - Build everything (schemas + docs)"
75-
@echo " build-schemas - Convert YAML schemas from src/ to JSON in output/ (preserving folder structure)"
76-
@echo " build-docs - Generate Markdown documentation from YAML schemas"
77-
@echo " config - Setup dependencies (Python, PyYAML)"
78-
@echo " list - List all YAML schema files that would be processed"
79-
@echo " clean - Remove output and docs directories"
80-
@echo " help - Show this help message"
101+
@echo " all - Build everything (complete documentation package) (default)"
102+
@echo " build - Build everything (complete documentation package)"
103+
@echo " build-schemas - Convert YAML schemas to JSON only (in output/schemas/)"
104+
@echo " build-docs - Generate complete documentation package (JSON + YAML + Markdown docs)"
105+
@echo " build-docs-yaml - Generate only YAML documentation (for tool consumption)"
106+
@echo " build-docs-md - Generate only Markdown documentation (requires YAML docs)"
107+
@echo " build-docs-legacy - Generate documentation using legacy single-stage approach"
108+
@echo " config - Setup dependencies (Python, PyYAML)"
109+
@echo " list - List all YAML schema files that would be processed"
110+
@echo " clean - Remove output directories"
111+
@echo " help - Show this help message"
81112
@echo ""
82113
@echo "Source schemas are looked for in: $(SCHEMA_SRC_DIR)/"
83-
@echo "Output JSON files are generated in: $(OUTPUT_DIR)/ (with preserved folder structure)"
84-
@echo "Documentation files are generated in: $(DOCS_DIR)/ (with preserved folder structure)"
114+
@echo "Output structure:"
115+
@echo " $(OUTPUT_DIR)/"
116+
@echo " ├── docs/"
117+
@echo " │ ├── yaml/ # YAML documentation files"
118+
@echo " │ └── md/ # Markdown documentation files"
119+
@echo " └── schemas/ # JSON schema files (converted from YAML)"
85120

86121
# List all YAML schema files
87122
list:

0 commit comments

Comments
 (0)