Skip to content

Commit

Permalink
fix(schema): make api_version read-only in schema
Browse files Browse the repository at this point in the history
resolves #216
  • Loading branch information
mostaphaRoudsari committed Dec 10, 2020
1 parent 326b731 commit b50912c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion queenbee/job/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Job(BaseModel):
A Job is an object to submit a list of arguments to execute a Queenbee recipe.
"""
api_version: constr(regex='^v1beta1$') = 'v1beta1'
api_version: constr(regex='^v1beta1$') = Field('v1beta1', readOnly=True)

type: constr(regex='^Job$') = 'Job'

Expand Down
2 changes: 1 addition & 1 deletion queenbee/job/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class StepStatus(BaseStatus):

class JobStatus(BaseStatus):
"""Job Status."""
api_version: constr(regex='^v1beta1$') = 'v1beta1'
api_version: constr(regex='^v1beta1$') = Field('v1beta1', readOnly=True)

type: constr(regex='^JobStatus$') = 'JobStatus'

Expand Down
2 changes: 1 addition & 1 deletion queenbee/plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Plugin(BaseModel):
A plugin contains runtime configuration for a Command Line Interface (CLI) and
a list of functions that can be executed using this CLI tool.
"""
api_version: constr(regex='^v1beta1$') = 'v1beta1'
api_version: constr(regex='^v1beta1$') = Field('v1beta1', readOnly=True)

type: constr(regex='^Plugin') = 'Plugin'

Expand Down
4 changes: 2 additions & 2 deletions queenbee/recipe/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def from_plugin(cls, plugin: Plugin) -> list:

class Recipe(BaseModel):
"""A Queenbee Recipe"""
api_version: constr(regex='^v1beta1$') = 'v1beta1'
api_version: constr(regex='^v1beta1$') = Field('v1beta1', readOnly=True)

type: constr(regex='^Recipe$') = 'Recipe'

Expand Down Expand Up @@ -687,7 +687,7 @@ class RecipeInterface(BaseModel):
Recipe information only includes metadata, source, inputs and outputs of a Recipe.
This object is useful for creating user interface for Recipes.
"""
api_version: constr(regex='^v1beta1$') = 'v1beta1'
api_version: constr(regex='^v1beta1$') = Field('v1beta1', readOnly=True)

type: constr(regex='^RecipeInterface$') = 'RecipeInterface'

Expand Down
2 changes: 1 addition & 1 deletion queenbee/repository/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class RepositoryMetadata(BaseModel):

class RepositoryIndex(BaseModel):
"""A searchable index for a Queenbee Plugin and Recipe repository"""
api_version: constr(regex='^v1beta1$') = 'v1beta1'
api_version: constr(regex='^v1beta1$') = Field('v1beta1', readOnly=True)

type: constr(regex='^RepositoryIndex$') = 'RepositoryIndex'

Expand Down

0 comments on commit b50912c

Please sign in to comment.