Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ using OpenAPI;
*
*/
@service(#{ title: "HyperFleet API" })
@info(#{ version: "1.0.0", contact: #{ name: "HyperFleet Team" }, license: #{ name: "Apache 2.0" ,url: "https://www.apache.org/licenses/LICENSE-2.0"} })
@info(#{ version: "1.0.1", contact: #{ name: "HyperFleet Team" }, license: #{ name: "Apache 2.0" ,url: "https://www.apache.org/licenses/LICENSE-2.0"} })
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Bump to major version instead of patch.

Adding a new required field to API responses is a breaking change per semantic versioning standards. Breaking changes require a new major API version, so this should be 2.0.0 rather than 1.0.1.

🤖 Prompt for AI Agents
In main.tsp around line 23, the API version was updated only as a patch (1.0.1)
despite introducing a breaking change (new required response field); update the
version string to a new major release (2.0.0) in the @info annotation so the API
follows semantic versioning for breaking changes.

@server("https://hyperfleet.redhat.com", "Production")
@route("/api/hyperfleet/v1")
namespace HyperFleet;
Expand Down
1 change: 1 addition & 0 deletions models-core/nodepool/example_nodepool.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const exampleNodePool: NodePool = #{
name: "worker-pool-1",
labels: #{ environment: "production", pooltype: "worker" },
spec: #{},
generation: 1,
created_time: "2021-01-01T00:00:00Z",
updated_time: "2021-01-01T00:00:00Z",
created_by: "user-123@example.com",
Expand Down
1 change: 1 addition & 0 deletions models-gcp/nodepool/example_nodepool.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const exampleNodePool: NodePool = #{
href: "https://api.hyperfleet.com/v1/nodepools/nodepool-123",
name: "worker-pool-1",
labels: #{ environment: "production", pooltype: "worker" },
generation: 1,
spec: #{
platform: #{
type: "gcp",
Expand Down
10 changes: 5 additions & 5 deletions models/clusters/model.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ model ClusterBase extends APIResource {
/**
* Cluster name (unique)
*/
@minLength(1)
@minLength(3)
@maxLength(63)
@pattern("^[a-z0-9-]+$")
@pattern("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")
name: string;

/** Cluster specification
Expand Down Expand Up @@ -61,16 +61,16 @@ model ClusterStatus {
}

@example(exampleCluster)
model Cluster extends ClusterBase {
...APICreatedResource;
model Cluster extends ClusterBase {
...APICreatedResource;

/**
* Generation field is updated on customer updates, reflecting the version of the "intent" of the customer
*/
@minValue(1)
generation: int32;

status: ClusterStatus;

}

@example(exampleClusterCreateRequest)
Expand Down
2 changes: 2 additions & 0 deletions models/common/model.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ enum OrderDirection {
}

model SearchParams {
/** Filter results using TSL (Tree Search Language) query syntax.
* Examples: `status.phase='NotReady'`, `name in ('c1','c2')`, `labels.region='us-east'` */
@query
search?: string;
}
Expand Down
23 changes: 16 additions & 7 deletions models/nodepools/model.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import "../../aliases.tsp";

model NodePoolBase {
...APIResource;

/**
* NodePool name (unique in a cluster)
*/
@minLength(3)
@maxLength(63)
@pattern("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")
name: string;

/** Cluster specification
/** NodePool specification
* CLM doesn't know how to unmarshall the spec, it only stores and forwards to adapters to do their job
* But CLM will validate the schema before accepting the request
*/
Expand Down Expand Up @@ -54,21 +58,26 @@ model NodePoolStatus {
}

@example(exampleNodePool)
model NodePool extends NodePoolBase{
model NodePool extends NodePoolBase {
...APICreatedResource;

...APICreatedResource;
owner_references: ObjectReference;
/**
* Generation field is updated on customer updates, reflecting the version of the "intent" of the customer
*/
@minValue(1)
generation: int32;

status: NodePoolStatus;
owner_references: ObjectReference;
status: NodePoolStatus;
}

@example(exampleNodePoolCreateRequest)
model NodePoolCreateRequest {
...NodePoolBase;
...NodePoolBase;
}

model NodePoolCreateResponse {
...NodePool
...NodePool;
}

model NodePoolList extends List {
Expand Down
59 changes: 53 additions & 6 deletions schemas/core/openapi.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.0.0
info:
title: HyperFleet API
version: 1.0.0
version: 1.0.1
contact:
name: HyperFleet Team
license:
Expand Down Expand Up @@ -40,6 +40,8 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- BearerAuth: []
post:
operationId: postCluster
summary: Create cluster
Expand Down Expand Up @@ -71,6 +73,8 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ClusterCreateRequest'
security:
- BearerAuth: []
/api/hyperfleet/v1/clusters/{cluster_id}:
get:
operationId: getClusterById
Expand All @@ -97,6 +101,8 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- BearerAuth: []
/api/hyperfleet/v1/clusters/{cluster_id}/nodepools:
get:
operationId: getNodePoolsByClusterId
Expand Down Expand Up @@ -129,6 +135,8 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- BearerAuth: []
post:
operationId: createNodePool
summary: Create nodepool
Expand Down Expand Up @@ -161,6 +169,8 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/NodePoolCreateRequest'
security:
- BearerAuth: []
/api/hyperfleet/v1/clusters/{cluster_id}/nodepools/{nodepool_id}:
get:
operationId: getNodePoolById
Expand Down Expand Up @@ -194,6 +204,8 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- BearerAuth: []
/api/hyperfleet/v1/clusters/{cluster_id}/nodepools/{nodepool_id}/statuses:
post:
operationId: postNodePoolStatuses
Expand Down Expand Up @@ -307,6 +319,8 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/AdapterStatusCreateRequest'
security:
- BearerAuth: []
get:
operationId: getClusterStatuses
summary: List all adapter statuses for cluster
Expand Down Expand Up @@ -334,6 +348,8 @@ paths:
description: The server could not understand the request due to invalid syntax.
'404':
description: The server cannot find the requested resource.
security:
- BearerAuth: []
/api/hyperfleet/v1/nodepools:
get:
operationId: getNodePools
Expand All @@ -360,6 +376,8 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- BearerAuth: []
components:
parameters:
QueryParams.order:
Expand Down Expand Up @@ -399,6 +417,9 @@ components:
name: search
in: query
required: false
description: |-
Filter results using TSL (Tree Search Language) query syntax.
Examples: `status.phase='NotReady'`, `name in ('c1','c2')`, `labels.region='us-east'`
schema:
type: string
explode: false
Expand Down Expand Up @@ -704,9 +725,9 @@ components:
default: Cluster
name:
type: string
minLength: 1
minLength: 3
maxLength: 63
pattern: ^[a-z0-9-]+$
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
description: Cluster name (unique)
spec:
allOf:
Expand Down Expand Up @@ -904,6 +925,7 @@ components:
- updated_time
- created_by
- updated_by
- generation
- owner_references
- status
properties:
Expand All @@ -919,6 +941,11 @@ components:
updated_by:
type: string
format: email
generation:
type: integer
format: int32
minimum: 1
description: Generation field is updated on customer updates, reflecting the version of the "intent" of the customer
owner_references:
$ref: '#/components/schemas/ObjectReference'
status:
Expand All @@ -934,6 +961,7 @@ components:
environment: production
pooltype: worker
spec: {}
generation: 1
created_time: '2021-01-01T00:00:00Z'
updated_time: '2021-01-01T00:00:00Z'
created_by: user-123@example.com
Expand Down Expand Up @@ -986,12 +1014,15 @@ components:
description: Resource URI
name:
type: string
minLength: 3
maxLength: 63
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
description: NodePool name (unique in a cluster)
spec:
allOf:
- $ref: '#/components/schemas/NodePoolSpec'
description: |-
Cluster specification
NodePool specification
CLM doesn't know how to unmarshall the spec, it only stores and forwards to adapters to do their job
But CLM will validate the schema before accepting the request
NodePoolCreateRequest:
Expand All @@ -1016,12 +1047,15 @@ components:
description: Resource URI
name:
type: string
minLength: 3
maxLength: 63
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
description: NodePool name (unique in a cluster)
spec:
allOf:
- $ref: '#/components/schemas/NodePoolSpec'
description: |-
Cluster specification
NodePool specification
CLM doesn't know how to unmarshall the spec, it only stores and forwards to adapters to do their job
But CLM will validate the schema before accepting the request
example:
Expand All @@ -1037,6 +1071,7 @@ components:
- updated_time
- created_by
- updated_by
- generation
- owner_references
- status
- name
Expand All @@ -1054,6 +1089,11 @@ components:
updated_by:
type: string
format: email
generation:
type: integer
format: int32
minimum: 1
description: Generation field is updated on customer updates, reflecting the version of the "intent" of the customer
owner_references:
$ref: '#/components/schemas/ObjectReference'
status:
Expand All @@ -1074,12 +1114,15 @@ components:
description: Resource URI
name:
type: string
minLength: 3
maxLength: 63
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
description: NodePool name (unique in a cluster)
spec:
allOf:
- $ref: '#/components/schemas/NodePoolSpec'
description: |-
Cluster specification
NodePool specification
CLM doesn't know how to unmarshall the spec, it only stores and forwards to adapters to do their job
But CLM will validate the schema before accepting the request
NodePoolList:
Expand Down Expand Up @@ -1196,6 +1239,10 @@ components:
- Ready
- Failed
description: Phase of a resource (Cluster or NodePool)
securitySchemes:
BearerAuth:
type: http
scheme: bearer
servers:
- url: https://hyperfleet.redhat.com
description: Production
Expand Down
Loading