Skip to content
Merged
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
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ include LICENSE.txt
include README.rst
include requirements/base.in
include requirements/constraints.txt
recursive-include openedx_authz *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.conf *.policy
recursive-include openedx_authz *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.conf *.policy *.yaml *.yml
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.
Comment thread
mariajgrimaldi marked this conversation as resolved.

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