feat(ecosystem): adopt hub-core dependency and CI pin gate (CORE-WP-0009)
Import slugify_or_default from hub-core, add contract tests, vendor hub-core in Docker/Forgejo CI, document metadata isolation and pagination deferral, and align INTENT/SCOPE with three-repo stack.
This commit is contained in:
parent
564830c4aa
commit
0709262ffd
21 changed files with 1082 additions and 55 deletions
|
|
@ -1,7 +1,8 @@
|
|||
import json
|
||||
import re
|
||||
from typing import Annotated, Any
|
||||
|
||||
from hub_core.utils.slugs import slugify_or_default
|
||||
|
||||
from fastapi import APIRouter, Depends, Query, Request, status
|
||||
from fastapi.responses import PlainTextResponse, RedirectResponse
|
||||
from sqlalchemy import select
|
||||
|
|
@ -31,11 +32,6 @@ TokenDependency = Annotated[str, Depends(require_api_token)]
|
|||
SessionDependency = Annotated[AsyncSession, Depends(session_scope)]
|
||||
|
||||
|
||||
def slugify(value: str) -> str:
|
||||
slug = re.sub(r"[^a-z0-9]+", "-", value.lower()).strip("-")
|
||||
return slug or "resource"
|
||||
|
||||
|
||||
def encode_body(payload: dict[str, Any]) -> str:
|
||||
return json.dumps(payload, sort_keys=True)
|
||||
|
||||
|
|
@ -246,7 +242,7 @@ async def create_api_consumer(
|
|||
body: dict[str, Any], _: TokenDependency, session: SessionDependency
|
||||
) -> dict[str, Any]:
|
||||
row = ApiConsumer(
|
||||
slug=body.get("slug") or slugify(body["name"]),
|
||||
slug=body.get("slug") or slugify_or_default(body["name"]),
|
||||
name=body["name"],
|
||||
description=body.get("description"),
|
||||
hub_capability_manifest_id=body.get("hubCapabilityManifestId"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue