-
Notifications
You must be signed in to change notification settings - Fork 37
feat: sync models from UCP and update sdk version to 0.3 #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
cusell-google
wants to merge
6
commits into
Universal-Commerce-Protocol:main
from
cusell-google:update-sdk-0.3
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
031d901
Add license metadata to pyproject.toml and update footer
cusell-google c3d789a
Update author to Enric Cusell in pyproject.toml
cusell-google 51d000c
Merge branch 'main' into main
cusell-google dabd6b9
build: keep Florin and add Enric to authors
cusell-google c9b4c1c
Merge branch 'main' into main
cusell-google 4ff1676
feat: sync UCP models and update SDK version to 0.3
cusell-google File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,3 +15,4 @@ | |
| # generated by datamodel-codegen | ||
| # pylint: disable=all | ||
| # pyformat: disable | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Copyright 2026 UCP Authors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # generated by datamodel-codegen | ||
| # pylint: disable=all | ||
| # pyformat: disable | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| # Copyright 2026 UCP Authors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # generated by datamodel-codegen | ||
| # pylint: disable=all | ||
| # pyformat: disable | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import Any, Literal | ||
|
|
||
| from pydantic import AnyUrl, BaseModel, ConfigDict, Field, RootModel | ||
|
|
||
| from ..capability import BusinessSchema as BusinessSchema_1 | ||
| from ..capability import PlatformSchema as PlatformSchema_1 | ||
|
|
||
|
|
||
| class IdentityLinkingCapability(RootModel[Any]): | ||
| model_config = ConfigDict( | ||
| frozen=True, | ||
| ) | ||
| root: Any = Field(..., title="Identity Linking Capability") | ||
| """ | ||
| Schema for authenticating and establishing verified connections between platforms and businesses. | ||
| """ | ||
|
|
||
|
|
||
| class IdentityScope(RootModel[str]): | ||
| model_config = ConfigDict( | ||
| frozen=True, | ||
| ) | ||
| root: str = Field( | ||
| ..., | ||
| pattern="^[a-zA-Z0-9][a-zA-Z0-9_\\-]*(\\.[a-zA-Z0-9][a-zA-Z0-9_\\-]*)*\\.scopes\\.[a-zA-Z0-9][a-zA-Z0-9_\\-]*(\\.[a-zA-Z0-9][a-zA-Z0-9_\\-]*)*$", | ||
| ) | ||
|
|
||
|
|
||
| class IdentityScopes(RootModel[list[IdentityScope]]): | ||
| """ | ||
| A custom UCP annotation placed at the root of a capability schema to declare the OAuth 2.0 scopes required to operate that capability. Scopes MUST use reverse DNS dot notation to prevent namespace collisions (e.g., 'dev.ucp.shopping.scopes.checkout_session' for UCP-defined scopes, 'com.example.scopes.my_capability' for third-party scopes). Platforms collect this annotation from every capability in the finalized negotiated intersection and use the union as the authorization scope set. This annotation is intentionally a plain JSON array so it is ignored by standard JSON Schema validators — it carries semantic meaning only to UCP-aware tooling. Absence of this annotation on a capability schema means that capability requires no dedicated scope. | ||
| """ | ||
|
|
||
| model_config = ConfigDict( | ||
| frozen=True, | ||
| ) | ||
| root: list[IdentityScope] = Field( | ||
| ..., min_length=1, title="Identity Scopes Annotation" | ||
| ) | ||
| """ | ||
| A custom UCP annotation placed at the root of a capability schema to declare the OAuth 2.0 scopes required to operate that capability. Scopes MUST use reverse DNS dot notation to prevent namespace collisions (e.g., 'dev.ucp.shopping.scopes.checkout_session' for UCP-defined scopes, 'com.example.scopes.my_capability' for third-party scopes). Platforms collect this annotation from every capability in the finalized negotiated intersection and use the union as the authorization scope set. This annotation is intentionally a plain JSON array so it is ignored by standard JSON Schema validators — it carries semantic meaning only to UCP-aware tooling. Absence of this annotation on a capability schema means that capability requires no dedicated scope. | ||
| """ | ||
|
|
||
|
|
||
| class Mechanism(BaseModel): | ||
| """ | ||
| Base definition for any authentication mechanism. The 'type' field discriminates between known mechanism schemas (e.g., oauth2). Unknown types pass through with only the base requirement, enabling forward-compatible extensibility. Note: this open base schema does not enforce field requirements for known types — use $defs/oauth2 directly to validate an oauth2 mechanism object explicitly. | ||
| """ | ||
|
|
||
| model_config = ConfigDict( | ||
| extra="allow", | ||
| ) | ||
| type: str | ||
| """ | ||
| The mechanism type discriminator. Known values: 'oauth2'. Specific mechanism schemas constrain this to a constant value. | ||
| """ | ||
|
|
||
|
|
||
| class Oauth2(BaseModel): | ||
| model_config = ConfigDict( | ||
| extra="allow", | ||
| ) | ||
| type: Literal["oauth2"] | ||
| """ | ||
| OAuth 2.0 authentication mechanism. | ||
| """ | ||
| issuer: AnyUrl | ||
| """ | ||
| The authorization server URL, supporting RFC 8414 discovery. | ||
| """ | ||
| discovery_endpoint: AnyUrl | None = None | ||
| """ | ||
| Optional explicit URI to the authorization server's metadata (e.g., `https://auth.merchant.example.com/.well-known/openid-configuration`). If omitted, platforms construct discovery paths based on the `issuer`. | ||
| """ | ||
|
|
||
|
|
||
| class PlatformSchema(PlatformSchema_1): | ||
| model_config = ConfigDict( | ||
| extra="allow", | ||
| ) | ||
|
|
||
|
|
||
| class Config(BaseModel): | ||
| model_config = ConfigDict( | ||
| extra="allow", | ||
| ) | ||
| supported_mechanisms: list[Mechanism] = Field(..., min_length=1) | ||
|
|
||
|
|
||
| class BusinessSchema(BusinessSchema_1): | ||
| model_config = ConfigDict( | ||
| extra="allow", | ||
| ) | ||
| config: Config |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is significant duplication of
Extendstypes (e.g.,Extends,Extends2,Extends4,Extends6are identicalRootModel[str]definitions). This appears to be an artifact of the code generation process. Consolidating these into a single reusable type would improve the maintainability and readability of the SDK models.