Skip to content

Commit 6a4e8ff

Browse files
hdamkerhdamker-bot
andauthored
Update test feature branch (#57)
* Update release-automation.yml (#50) * test: add sample-service API with external $ref to common schemas Adds sample-service.yaml (from Commonalities restructure-artifacts) which uses $ref to ../common/CAMARA_common.yaml for shared schemas, error responses, headers, and security schemes. Smoke test for bundling pipeline (WP-06.08, DEC-021). * test: add sample-service to release-plan.yaml Declares sample-service as alpha 0.1.0 alongside existing release-test. * Update release automation workflow version * Rename workflow and update reusable workflow reference (#53) Updated the workflow name and changed the repository reference for the reusable workflow. * chore: update workflow references to upstream tooling (#54) * chore: update workflow references to upstream tooling * test: add sample-service feature file for validation testing --------- Co-authored-by: hdamker-bot <herbert.damker@gmail.com>
1 parent aa869e2 commit 6a4e8ff

6 files changed

Lines changed: 1106 additions & 6 deletions

File tree

‎.github/workflows/release-automation.yml‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# - Push to main: when release-plan.yaml changes (auto sync-issue)
1313
# - Manual: workflow_dispatch triggers sync-issue (reads from release-plan.yaml)
1414

15-
name: Release Automation
15+
name: CAMARA Release Automation
1616

1717
on:
1818
# Slash commands via issue comments
@@ -80,7 +80,4 @@ jobs:
8080
github.event.pull_request.merged == true &&
8181
startsWith(github.event.pull_request.base.ref, 'release-snapshot/'))
8282
83-
uses: camaraproject/tooling/.github/workflows/release-automation-reusable.yml@release-automation
84-
# with:
85-
# tooling_ref_override: "0123456789abcdef0123456789abcdef01234567" # Optional break-glass SHA override (requires workflow file change)
86-
secrets: inherit
83+
uses: camaraproject/tooling/.github/workflows/release-automation-reusable.yml@validation-framework

‎.github/workflows/validation-caller.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ permissions:
3131

3232
jobs:
3333
validation:
34-
uses: hdamker/tooling/.github/workflows/validation.yml@validation-framework
34+
uses: camaraproject/tooling/.github/workflows/validation.yml@validation-framework
3535
secrets: inherit
Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
openapi: 3.0.3
2+
info:
3+
title: Sample CAMARA Service API
4+
description: |
5+
Template for a request-response CAMARA API.
6+
7+
Copy this file to your API repository's `code/API_definitions/` directory
8+
and adapt it to your API's resources and operations.
9+
10+
This template demonstrates:
11+
- `$ref` to `../common/CAMARA_common.yaml` for shared schemas, error responses,
12+
parameters, headers, and security schemes
13+
- Two options for error responses:
14+
- Option A: Pure `$ref` for responses using only generic error codes
15+
- Option B: Local response definition extending generic errors with API-specific codes
16+
license:
17+
name: Apache 2.0
18+
url: https://www.apache.org/licenses/LICENSE-2.0.html
19+
version: wip
20+
x-camara-commonalities: 0.7.0
21+
servers:
22+
- url: "{apiRoot}/sample-service/vwip"
23+
variables:
24+
apiRoot:
25+
default: http://localhost:9091
26+
description: API root, Apache 2.0 licensed
27+
tags:
28+
- name: Resources
29+
description: Operations on sample resources
30+
security:
31+
- openId:
32+
- sample-service:resource:read
33+
- sample-service:resource:write
34+
paths:
35+
/resources:
36+
post:
37+
tags:
38+
- Resources
39+
summary: Create a resource
40+
description: Creates a new resource with the provided properties.
41+
operationId: createResource
42+
parameters:
43+
- $ref: "../common/CAMARA_common.yaml#/components/parameters/x-correlator"
44+
requestBody:
45+
required: true
46+
content:
47+
application/json:
48+
schema:
49+
$ref: "#/components/schemas/CreateResource"
50+
responses:
51+
"201":
52+
description: Resource created
53+
headers:
54+
x-correlator:
55+
$ref: "../common/CAMARA_common.yaml#/components/headers/x-correlator"
56+
content:
57+
application/json:
58+
schema:
59+
$ref: "#/components/schemas/Resource"
60+
"400":
61+
$ref: "../common/CAMARA_common.yaml#/components/responses/Generic400"
62+
"401":
63+
$ref: "../common/CAMARA_common.yaml#/components/responses/Generic401"
64+
"403":
65+
$ref: "../common/CAMARA_common.yaml#/components/responses/Generic403"
66+
"409":
67+
$ref: "../common/CAMARA_common.yaml#/components/responses/Generic409"
68+
"422":
69+
$ref: "../common/CAMARA_common.yaml#/components/responses/Generic422"
70+
"429":
71+
$ref: "../common/CAMARA_common.yaml#/components/responses/Generic429"
72+
"500":
73+
$ref: "../common/CAMARA_common.yaml#/components/responses/Generic500"
74+
get:
75+
tags:
76+
- Resources
77+
summary: List resources
78+
description: Returns a list of all resources accessible to the API consumer.
79+
operationId: listResources
80+
parameters:
81+
- $ref: "../common/CAMARA_common.yaml#/components/parameters/x-correlator"
82+
responses:
83+
"200":
84+
description: List of resources
85+
headers:
86+
x-correlator:
87+
$ref: "../common/CAMARA_common.yaml#/components/headers/x-correlator"
88+
content:
89+
application/json:
90+
schema:
91+
type: array
92+
items:
93+
$ref: "#/components/schemas/Resource"
94+
"401":
95+
$ref: "../common/CAMARA_common.yaml#/components/responses/Generic401"
96+
"403":
97+
$ref: "../common/CAMARA_common.yaml#/components/responses/Generic403"
98+
"500":
99+
$ref: "../common/CAMARA_common.yaml#/components/responses/Generic500"
100+
/resources/{resourceId}:
101+
get:
102+
tags:
103+
- Resources
104+
summary: Get a resource by ID
105+
description: Returns the details of a specific resource identified by its ID.
106+
operationId: getResource
107+
parameters:
108+
- $ref: "#/components/parameters/ResourceId"
109+
- $ref: "../common/CAMARA_common.yaml#/components/parameters/x-correlator"
110+
responses:
111+
"200":
112+
description: Resource details
113+
headers:
114+
x-correlator:
115+
$ref: "../common/CAMARA_common.yaml#/components/headers/x-correlator"
116+
content:
117+
application/json:
118+
schema:
119+
$ref: "#/components/schemas/Resource"
120+
"401":
121+
$ref: "../common/CAMARA_common.yaml#/components/responses/Generic401"
122+
"403":
123+
$ref: "../common/CAMARA_common.yaml#/components/responses/Generic403"
124+
# Option A — pure $ref for responses using only generic error codes
125+
"404":
126+
$ref: "../common/CAMARA_common.yaml#/components/responses/Generic404"
127+
"500":
128+
$ref: "../common/CAMARA_common.yaml#/components/responses/Generic500"
129+
delete:
130+
tags:
131+
- Resources
132+
summary: Delete a resource
133+
description: Deletes a specific resource identified by its ID.
134+
operationId: deleteResource
135+
parameters:
136+
- $ref: "#/components/parameters/ResourceId"
137+
- $ref: "../common/CAMARA_common.yaml#/components/parameters/x-correlator"
138+
responses:
139+
"204":
140+
description: Resource deleted
141+
headers:
142+
x-correlator:
143+
$ref: "../common/CAMARA_common.yaml#/components/headers/x-correlator"
144+
"401":
145+
$ref: "../common/CAMARA_common.yaml#/components/responses/Generic401"
146+
"403":
147+
$ref: "../common/CAMARA_common.yaml#/components/responses/Generic403"
148+
# Option B — local response extending generic errors with API-specific codes
149+
"404":
150+
$ref: "#/components/responses/ResourceNotFound404"
151+
"500":
152+
$ref: "../common/CAMARA_common.yaml#/components/responses/Generic500"
153+
components:
154+
securitySchemes:
155+
openId:
156+
$ref: "../common/CAMARA_common.yaml#/components/securitySchemes/openId"
157+
responses:
158+
# Option B example: API-specific error response extending generic error codes.
159+
# Use this pattern when an operation needs API-specific error codes in addition
160+
# to the generic ones defined in CAMARA_common.yaml.
161+
ResourceNotFound404:
162+
description: Resource not found
163+
headers:
164+
x-correlator:
165+
$ref: "../common/CAMARA_common.yaml#/components/headers/x-correlator"
166+
content:
167+
application/json:
168+
schema:
169+
allOf:
170+
- $ref: "../common/CAMARA_common.yaml#/components/schemas/ErrorInfo"
171+
- type: object
172+
properties:
173+
status:
174+
enum:
175+
- 404
176+
code:
177+
enum:
178+
- NOT_FOUND
179+
- IDENTIFIER_NOT_FOUND
180+
examples:
181+
GENERIC_404_NOT_FOUND:
182+
description: The specified resource was not found
183+
value:
184+
status: 404
185+
code: NOT_FOUND
186+
message: The specified resource is not found.
187+
RESOURCE_404_IDENTIFIER_NOT_FOUND:
188+
description: API-specific — some identifier cannot be matched to a resource
189+
value:
190+
status: 404
191+
code: IDENTIFIER_NOT_FOUND
192+
message: Some of the provided identifiers are not found.
193+
parameters:
194+
ResourceId:
195+
name: resourceId
196+
in: path
197+
required: true
198+
description: Identifier of the resource to operate on
199+
schema:
200+
$ref: "#/components/schemas/ResourceId"
201+
schemas:
202+
ResourceId:
203+
type: string
204+
format: uuid
205+
description: Unique identifier for the resource
206+
CreateResource:
207+
description: Properties for creating a new resource
208+
type: object
209+
required:
210+
- name
211+
properties:
212+
name:
213+
type: string
214+
maxLength: 128
215+
description: Human-readable name for the resource
216+
device:
217+
$ref: "../common/CAMARA_common.yaml#/components/schemas/Device"
218+
Resource:
219+
description: A resource managed by the API
220+
type: object
221+
required:
222+
- resourceId
223+
- name
224+
properties:
225+
resourceId:
226+
$ref: "#/components/schemas/ResourceId"
227+
name:
228+
type: string
229+
maxLength: 128
230+
description: Human-readable name for the resource
231+
device:
232+
$ref: "../common/CAMARA_common.yaml#/components/schemas/Device"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Feature: CAMARA Sample Service API, vwip - Operation: createResource
2+
3+
# Input to be provided by the implementation to the tests
4+
# References to OAS spec schemas refer to schemas specified in /code/API_definitions/sample-service.yaml
5+
# Implementation indications:
6+
# * api_root: API root of the server URL
7+
#
8+
# Testing assets:
9+
# * A valid access token with scope sample-service:resource:write
10+
11+
Background: Common Sample Service createResource setup
12+
Given an environment at "apiRoot"
13+
And the resource "/sample-service/vwip/resources"
14+
And the header "Authorization" is set to a valid access token
15+
And the header "Content-Type" is set to "application/json"
16+
17+
# Success scenarios
18+
19+
@SampleService_createResource_201.01_success
20+
Scenario: Create resource successfully
21+
Given the request body is set to a valid CreateResource request
22+
When the HTTPS "POST" request is sent
23+
Then the response status code is 201
24+
And the response header "Content-Type" is "application/json"
25+
And the response header "x-correlator" has same value as the request header "x-correlator"
26+
And the response property "$.resourceId" exists
27+
And the response property "$.name" exists
28+
29+
# Error scenarios
30+
31+
@SampleService_createResource_400.01_invalid_request
32+
Scenario: Error response for invalid request body
33+
Given the request body is set to an invalid CreateResource request
34+
When the HTTPS "POST" request is sent
35+
Then the response status code is 400
36+
And the response header "Content-Type" is "application/json"
37+
And the response property "$.status" is 400
38+
And the response property "$.code" is "INVALID_ARGUMENT"
39+
And the response property "$.message" exists

0 commit comments

Comments
 (0)