Skip to content

Commit

Permalink
Add immutable after creation metadata to schema (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
harishmohanraj authored Sep 12, 2024
1 parent db90194 commit 9dcf941
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion fastagency/studio/models/deployments/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ class Deployment(Model):
]

repo_name: Annotated[
str, Field(..., description="The name of the GitHub repository.", min_length=1)
str,
Field(
...,
description="The name of the GitHub repository.",
min_length=1,
json_schema_extra={"metadata": {"immutable_after_creation": True}},
),
]

fly_app_name: Annotated[
Expand All @@ -44,6 +50,7 @@ class Deployment(Model):
description="The name of the Fly.io application.",
min_length=1,
max_length=30,
json_schema_extra={"metadata": {"immutable_after_creation": True}},
),
]

Expand All @@ -59,13 +66,15 @@ class Deployment(Model):
Field(
title="GH Token",
description="The GitHub token to use for creating a new repository",
json_schema_extra={"metadata": {"immutable_after_creation": True}},
),
]
fly_token: Annotated[
FlyTokenRef,
Field(
title="Fly Token",
description="The Fly.io token to use for deploying the deployment",
json_schema_extra={"metadata": {"immutable_after_creation": True}},
),
]

Expand Down
4 changes: 4 additions & 0 deletions tests/studio/models/deployments/test_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,15 @@ def test_deployment_model_schema(self, pydantic_version: float) -> None:
},
"repo_name": {
"description": "The name of the GitHub repository.",
"metadata": {"immutable_after_creation": True},
"minLength": 1,
"title": "Repo Name",
"type": "string",
},
"fly_app_name": {
"description": "The name of the Fly.io application.",
"maxLength": 30,
"metadata": {"immutable_after_creation": True},
"minLength": 1,
"title": "Fly App Name",
"type": "string",
Expand All @@ -167,11 +169,13 @@ def test_deployment_model_schema(self, pydantic_version: float) -> None:
"gh_token": {
"$ref": "#/$defs/GitHubTokenRef",
"description": "The GitHub token to use for creating a new repository",
"metadata": {"immutable_after_creation": True},
"title": "GH Token",
},
"fly_token": {
"$ref": "#/$defs/FlyTokenRef",
"description": "The Fly.io token to use for deploying the deployment",
"metadata": {"immutable_after_creation": True},
"title": "Fly Token",
},
},
Expand Down

0 comments on commit 9dcf941

Please sign in to comment.