Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions openedx_authz/authz/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""openedx-authz's own static authorization schema resources.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Need to apply the convention from this thread I think? #431

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done, thanks!


This package ships the platform-default schema files under ``authz/schema`` and
exposes that directory through the ``authz.schema`` entry point (ADR 0019).
openedx-authz is a schema provider like any other distribution; its directory is
discovered the same way a third-party application's would be, and the loader
reads every ``.yaml`` file inside it.

Register in setup.py / pyproject.toml::

entry_points = {
"authz.schema": [
"openedx_authz = openedx_authz.authz:get_schema_resources",
],
}
"""

from __future__ import annotations

# Directory paths (relative to an importable top-level package) that contain
# this distribution's ``.yaml`` schema files. Per ADR 0019, providers return
# directories, not individual files.
SCHEMA_DIRECTORIES: tuple[str, ...] = ("openedx_authz/authz/schema",)


def get_schema_resources() -> list[str]:
"""Return this package's schema directory paths.

The ``authz.schema`` entry point points at this callable; the discovery
step resolves each returned directory via ``importlib.resources`` and loads
every ``.yaml`` file it contains.
"""
return list(SCHEMA_DIRECTORIES)
Loading