Skip to content

Cc schemas#12

Merged
thwllms merged 41 commits intomainfrom
cc-schemas
Oct 9, 2025
Merged

Cc schemas#12
thwllms merged 41 commits intomainfrom
cc-schemas

Conversation

@slawler
Copy link
Copy Markdown
Member

@slawler slawler commented Sep 20, 2025

Summary

This PR implements a comprehensive schema documentation system and consolidates JSON schemas for the FFRD container specifications. The main focus is on creating automated documentation generation for JSON schemas and establishing a solid foundation for base image specifications.

Key Features Added

Automated Schema Documentation Generation

  • Created json_to_md.py script for converting JSON schemas to markdown documentation
  • Multi-directory processing - supports processing multiple schema/doc directory pairs
  • Reference resolution - automatically resolves $ref links between schemas
  • AllOf schema merging - properly handles complex schema inheritance
  • Clean table formatting - separates examples from property tables for better readability
  • Nested properties support - displays object properties with proper hierarchy

Schema Structure Improvements

  • Consolidated base schemas in reference/base/schemas/:
    • action.json - Base action schema with common properties
    • data.json - Data path and source definitions
    • store.json - Storage configuration schema
  • RAS-specific schemas in reference/ras/v660/schemas/:
    • action.ras.run_unsteady_simulation.json - Extends base action for RAS workflows

Documentation Enhancements

  • Auto-generated markdown with clean table formatting:
    • Property tables without cluttered examples column
    • Dedicated examples sections below tables
    • Explicit references section showing schema inheritance
  • Cross-references between schemas with clickable links
  • MkDocs integration with proper include paths

Infrastructure Updates

  • Base image Docker configuration and build scripts
  • RAS v6.6.0 container updates with new schema implementation
  • Validation scripts for schema compliance
  • Example configurations for different deployment scenarios

Schema Documentation Links

The generated documentation now includes:

  • Base Image Schemas: docs/draft/base_image/
  • RAS Simulation Schemas: docs/draft/ras_sim/
  • Automatic cross-linking between related schemas

Files Changed

  • New: Schema documentation generation system
  • Enhanced: Base and RAS container implementations
  • Improved: MkDocs configuration for better schema presentation
  • Added: Comprehensive validation and example configurations

Testing

  • MkDocs builds successfully with new schema documentation
  • Schema validation passes for all JSON files
  • Cross-references between schemas work correctly
  • Examples render properly in generated documentation

@slawler slawler requested review from Copilot and thwllms September 20, 2025 18:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a comprehensive schema documentation system and consolidates JSON schemas for the FFRD container specifications, with a focus on creating automated documentation generation for JSON schemas and establishing base image specifications.

  • Creates automated schema documentation generation with cross-reference support
  • Implements new base schemas for actions, data sources, and storage configurations
  • Adds RAS v6.6.0 container implementation with unsteady simulation support

Reviewed Changes

Copilot reviewed 31 out of 32 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
reference/ras/v660/schemas/action.ras.run_unsteady_simulation.json New schema defining RAS unsteady simulation action with input/output validation
reference/ras/v660/run_unsteady.py Main execution script for RAS unsteady simulations with S3/FS support
reference/ras/v660/parsers/unsteady_simulation_config.py Configuration parser with attribute substitution and dataclass definitions
reference/json_to_md.py Schema documentation generator with reference resolution and markdown output
reference/base/validate.py Updated JSON schema validator supporting Draft 2020-12 specification
reference/base/schemas/*.json Base schema definitions for actions, data sources, and storage

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

"description": "Schema for an unsteady HEC-RAS simulation action. Combines action metadata, attribute substitutions, input data sources, outputs, and store configuration.",
"allOf": [
{
"$ref": "./action.json#/$defs/Action"
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reference path './action.json#/$defs/Action' may not resolve correctly from this location. Based on the file structure, this should likely reference '../../base/schemas/action.json#/$defs/Action' to point to the base schemas directory.

Suggested change
"$ref": "./action.json#/$defs/Action"
"$ref": "../../base/schemas/action.json#/$defs/Action"

Copilot uses AI. Check for mistakes.
"type": "array",
"description": "Input data sources required for the unsteady simulation.",
"items": {
"$ref": "./data.json#/$defs/DataSource"
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reference path './data.json#/$defs/DataSource' may not resolve correctly from this location. Based on the file structure, this should likely reference '../../base/schemas/data.json#/$defs/DataSource' to point to the base schemas directory.

Suggested change
"$ref": "./data.json#/$defs/DataSource"
"$ref": "../../base/schemas/data.json#/$defs/DataSource"

Copilot uses AI. Check for mistakes.
"type": "array",
"description": "Output data sources produced by the unsteady simulation.",
"items": {
"$ref": "./data.json#/$defs/DataSource"
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reference path './data.json#/$defs/DataSource' may not resolve correctly from this location. Based on the file structure, this should likely reference '../../base/schemas/data.json#/$defs/DataSource' to point to the base schemas directory.

Copilot uses AI. Check for mistakes.
Comment thread reference/ras/v660/run_unsteady.py Outdated
Comment on lines +101 to +122
# local_paths = output.create_local_output_paths(local_source)

# # Get the file types dynamically from the OutputPaths object
# file_types = [field.name for field in fields(output.paths) if getattr(output.paths, field.name)]

# # Process the files for upload
# try:
# for file_type in file_types:
# local_path = local_paths[file_type]
# if not local_path or not os.path.exists(local_path):
# print(f"❌ Local file not found: {local_path}")
# return False
# s3_path = f"s3://{output.store_root}/{getattr(output.paths, file_type)}"
# subprocess.call([UPLOAD, s3_path, "--path", local_path])

# except Exception as e:
# print(f"❌ Error uploading files for output '{output_name}': {e}")
# return False

# return True


Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Large block of commented code should be removed rather than left in the codebase. If this functionality might be needed later, consider using version control history or creating a separate branch.

Suggested change
# local_paths = output.create_local_output_paths(local_source)
# # Get the file types dynamically from the OutputPaths object
# file_types = [field.name for field in fields(output.paths) if getattr(output.paths, field.name)]
# # Process the files for upload
# try:
# for file_type in file_types:
# local_path = local_paths[file_type]
# if not local_path or not os.path.exists(local_path):
# print(f"❌ Local file not found: {local_path}")
# return False
# s3_path = f"s3://{output.store_root}/{getattr(output.paths, file_type)}"
# subprocess.call([UPLOAD, s3_path, "--path", local_path])
# except Exception as e:
# print(f"❌ Error uploading files for output '{output_name}': {e}")
# return False
# return True

Copilot uses AI. Check for mistakes.
Comment thread reference/base/validate.py Outdated
#!/usr/bin/env python3
"""
JSON Schema Validator for RAS simulation schemas
Supports JSON Schema Draft 2020-12 with latest jsonschema librarys
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error: 'librarys' should be 'libraries'.

Suggested change
Supports JSON Schema Draft 2020-12 with latest jsonschema librarys
Supports JSON Schema Draft 2020-12 with latest jsonschema libraries

Copilot uses AI. Check for mistakes.
"$id": "./action.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Action",
"description": "A generic action (e.g. model simulatuion, data or transformation step) with typed inputs/outputs, parameterized paths, and optional operator parameters. See specific action schemas for specialized actions, attrubutes, and parameters.",
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple spelling errors in the description: 'simulatuion' should be 'simulation' and 'attrubutes' should be 'attributes'.

Suggested change
"description": "A generic action (e.g. model simulatuion, data or transformation step) with typed inputs/outputs, parameterized paths, and optional operator parameters. See specific action schemas for specialized actions, attrubutes, and parameters.",
"description": "A generic action (e.g. model simulation, data or transformation step) with typed inputs/outputs, parameterized paths, and optional operator parameters. See specific action schemas for specialized actions, attributes, and parameters.",

Copilot uses AI. Check for mistakes.
"description": "Map of domain keys to in-file selectors (optional unless required by the specific action)."
},
"store": {
"$ref": "file:///app/schemas/store.json",
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The absolute file path reference 'file:///app/schemas/store.json' is likely incorrect and will not resolve properly. This should use a relative reference like './store.json#/$defs/Store' to match the pattern used elsewhere.

Suggested change
"$ref": "file:///app/schemas/store.json",
"$ref": "./store.json#/$defs/Store",

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,25 @@
# Action

A generic action (e.g. model simulatuion, data or transformation step) with typed inputs/outputs, parameterized paths, and optional operator parameters. See specific action schemas for specialized actions, attrubutes, and parameters.
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple spelling errors in the description: 'simulatuion' should be 'simulation' and 'attrubutes' should be 'attributes'.

Suggested change
A generic action (e.g. model simulatuion, data or transformation step) with typed inputs/outputs, parameterized paths, and optional operator parameters. See specific action schemas for specialized actions, attrubutes, and parameters.
A generic action (e.g. model simulation, data or transformation step) with typed inputs/outputs, parameterized paths, and optional operator parameters. See specific action schemas for specialized actions, attributes, and parameters.

Copilot uses AI. Check for mistakes.
@slawler slawler changed the base branch from main to orchestration September 26, 2025 19:11
@slawler slawler requested a review from barne856 September 26, 2025 19:12
@daniel-aragon-MBI daniel-aragon-MBI changed the base branch from orchestration to main October 1, 2025 15:27
Comment thread reference/ras/v660/entrypoint.sh Outdated
@thwllms thwllms merged commit f3a213e into main Oct 9, 2025
7 checks passed
@thwllms thwllms deleted the cc-schemas branch October 9, 2025 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants