Skip to content

Commit

Permalink
Replace custom schema generation with library
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindeide committed Dec 20, 2024
1 parent 5c9ccaa commit c9b5fdc
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 1,650 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/test_everest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ jobs:
uv pip install git+https://github.com/equinor/everest-models.git
python -m pytest tests/everest -n 4 --cov=ert --cov=everest --cov=_ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -m everest_models_test --dist loadgroup
- name: Test docs entry point
if: inputs.test-type == 'everest-docs-entry-test'
run: |
python -m everest.docs
- name: Upload coverage to Codecov
if: inputs.test-type != 'everest-docs-entry-test' && inputs.test-type != 'doc'
id: codecov1
Expand Down
24 changes: 23 additions & 1 deletion docs/everest/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
import json

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
Expand Down Expand Up @@ -34,6 +34,28 @@
# The full version, including alpha/beta/rc tags
release = dist_version

from json_schema_for_humans.generate import generate_from_filename
from json_schema_for_humans.generation_configuration import GenerationConfiguration

from everest.config import EverestConfig

config = GenerationConfiguration(
copy_css=False,
expand_buttons=True,
link_to_reused_ref=False,
show_breadcrumbs=False,
examples_as_yaml=True,
)
with open("config_schema.json", "w", encoding="utf-8") as fout:
json.dump(EverestConfig.model_json_schema(), fout)

generate_from_filename("config_schema.json", "config_schema.html", config=config)

with open("config_schema.html", encoding="utf-8") as fin:
data = fin.read()
data = data.replace("schema_doc.css", "_static/styles/furo.css")
with open("config_schema.html", "w", encoding="utf-8") as fout:
fout.write(data)

# -- General configuration ---------------------------------------------------

Expand Down
Loading

0 comments on commit c9b5fdc

Please sign in to comment.