generated from coulomb/repo-seed
Bundle hub registration schema in the installed package
Some checks failed
ci / validate-registry (push) Has been cancelled
Some checks failed
ci / validate-registry (push) Has been cancelled
Load the schema from reuse_surface/hub/ next to store.py and declare package-data so pip install includes the YAML in site-packages. Fixes hub register 500 in the container image.
This commit is contained in:
@@ -27,3 +27,6 @@ reuse-surface = "reuse_surface.cli:main"
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["."]
|
||||
include = ["reuse_surface*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
reuse_surface = ["hub/hub-registration.schema.yaml"]
|
||||
148
reuse_surface/hub/hub-registration.schema.yaml
Normal file
148
reuse_surface/hub/hub-registration.schema.yaml
Normal file
@@ -0,0 +1,148 @@
|
||||
$schema: https://json-schema.org/draft/2020-12/schema
|
||||
$id: https://reuse-surface.local/schemas/hub-registration.schema.yaml
|
||||
title: Federation Hub Repo Registration
|
||||
description: >
|
||||
Schema for a repository registration stored by the federation hub service.
|
||||
Extends federation source fields with hub metadata.
|
||||
type: object
|
||||
additionalProperties: false
|
||||
required: [repo, url, enabled, domain]
|
||||
properties:
|
||||
repo:
|
||||
type: string
|
||||
minLength: 1
|
||||
pattern: '^[a-z][a-z0-9-]*$'
|
||||
description: Stable repository slug (primary key)
|
||||
url:
|
||||
type: string
|
||||
format: uri
|
||||
pattern: '^https?://'
|
||||
description: Published HTTP(S) URL to capabilities.yaml
|
||||
enabled:
|
||||
type: boolean
|
||||
required:
|
||||
type: boolean
|
||||
default: false
|
||||
domain:
|
||||
type: string
|
||||
minLength: 1
|
||||
description: Capability domain label (e.g. helix_forge)
|
||||
description:
|
||||
type: string
|
||||
cache_ttl_seconds:
|
||||
type: integer
|
||||
minimum: 0
|
||||
default: 86400
|
||||
auth_env:
|
||||
type: string
|
||||
minLength: 1
|
||||
description: >
|
||||
Hub-side environment variable name holding a token for fetching this
|
||||
source index (not exposed in API responses)
|
||||
auth_header:
|
||||
type: string
|
||||
minLength: 1
|
||||
default: Authorization
|
||||
registered_at:
|
||||
type: string
|
||||
format: date-time
|
||||
description: Hub metadata — set on create
|
||||
updated_at:
|
||||
type: string
|
||||
format: date-time
|
||||
description: Hub metadata — set on create/update
|
||||
registered_by:
|
||||
type: string
|
||||
description: Optional actor label from write token or client header
|
||||
$defs:
|
||||
registration_request:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
required: [repo, url, domain]
|
||||
properties:
|
||||
repo:
|
||||
type: string
|
||||
minLength: 1
|
||||
pattern: '^[a-z][a-z0-9-]*$'
|
||||
url:
|
||||
type: string
|
||||
format: uri
|
||||
pattern: '^https?://'
|
||||
enabled:
|
||||
type: boolean
|
||||
default: true
|
||||
required:
|
||||
type: boolean
|
||||
default: false
|
||||
domain:
|
||||
type: string
|
||||
minLength: 1
|
||||
description:
|
||||
type: string
|
||||
cache_ttl_seconds:
|
||||
type: integer
|
||||
minimum: 0
|
||||
default: 86400
|
||||
auth_env:
|
||||
type: string
|
||||
minLength: 1
|
||||
auth_header:
|
||||
type: string
|
||||
minLength: 1
|
||||
default: Authorization
|
||||
registered_by:
|
||||
type: string
|
||||
registration_update:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
url:
|
||||
type: string
|
||||
format: uri
|
||||
pattern: '^https?://'
|
||||
enabled:
|
||||
type: boolean
|
||||
required:
|
||||
type: boolean
|
||||
domain:
|
||||
type: string
|
||||
minLength: 1
|
||||
description:
|
||||
type: string
|
||||
cache_ttl_seconds:
|
||||
type: integer
|
||||
minimum: 0
|
||||
auth_env:
|
||||
type: string
|
||||
minLength: 1
|
||||
auth_header:
|
||||
type: string
|
||||
minLength: 1
|
||||
registered_by:
|
||||
type: string
|
||||
minProperties: 1
|
||||
repo_list:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
required: [repos, count]
|
||||
properties:
|
||||
repos:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#'
|
||||
count:
|
||||
type: integer
|
||||
minimum: 0
|
||||
error_response:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
required: [error, message]
|
||||
properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
details:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
@@ -9,9 +9,7 @@ from typing import Any
|
||||
import yaml
|
||||
from jsonschema import Draft202012Validator
|
||||
|
||||
from reuse_surface.registry import ROOT
|
||||
|
||||
SCHEMA_PATH = ROOT / "schemas" / "hub-registration.schema.yaml"
|
||||
SCHEMA_PATH = Path(__file__).resolve().parent / "hub-registration.schema.yaml"
|
||||
|
||||
|
||||
def _utc_now() -> str:
|
||||
|
||||
Reference in New Issue
Block a user