Skip to content

Commit 5ce25fd

Browse files
authored
Merge pull request #44 from API-Flows/introduce-arazzo
Introduce Arazzo
2 parents 7037882 + 40a957f commit 5ce25fd

File tree

11 files changed

+32
-32
lines changed

11 files changed

+32
-32
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
# OpenAPI Workflow Parser
1+
# OpenAPI Workflow (Arazzo) Parser
22

33
[![](https://badgen.net/github/license/API-Flows/openapi-workflow-parser)](LICENSE)
44
[![](https://badgen.net/maven/v/maven-central/com.api-flows/openapi-workflow-parser)](https://repo1.maven.org/maven2/com/api-flows/openapi-workflow-parser/)
55
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=API-Flows_openapi-workflow-parser&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=API-Flows_openapi-workflow-parser)
66

7-
Parsing OpenAPI workflows.
7+
Parsing API workflows.
88

99
## Overview
1010

11-
The OpenAPI Workflow parser is an open-source Java library designed to parse the [OpenAPI SIG-Workflows specification](https://github.com/OAI/sig-workflows) files. It reads an OpenAPI workflow file (JSON or YAML formats are supported) and creates the corresponding Java objects.
11+
The OpenAPI Workflow parser is an open-source Java library designed to parse the [OAI Arazzo specification](https://https://github.com/OAI/Arazzo-Specification/) files. It reads an Arazzo file (JSON or YAML formats are supported) and creates the corresponding Java objects.
1212

13-
The parser's goal is to simplify the extraction and manipulation of OpenAPI workflows, helping developers create applications and tools that harness the semantic structure of API flows.
13+
The parser's goal is to simplify the extraction and manipulation of workflows, helping developers create applications and tools that harness the semantic structure of API flows.
1414

1515
## Features
1616

17-
- **Workflow Parsing:** Reads OpenAPI specification files loading the corresponding Java objects.
18-
- **Ease of Use:** Provides a simple way for developers to parse OpenAPI workflows.
19-
- **Compatibility:** Supports OpenAPI specifications in JSON and YAML formats.
20-
- **Validation:** Validates the OpenAPI specification according to the [Workflows Specification v1.0.0](https://github.com/OAI/sig-workflows/blob/main/versions/1.0.0.md).
17+
- **Workflow Parsing:** Reads OAI Arazzo specification files loading the corresponding Java objects.
18+
- **Ease of Use:** Provides a simple way for developers to parse workflows.
19+
- **Compatibility:** Supports both JSON and YAML formats.
20+
- **Validation:** Validates the specification according to the [Arazzo Specification v1.0.0](https://https://github.com/OAI/Arazzo-Specification/).
2121

2222
## Usage
2323

src/main/java/com/apiflows/model/OpenAPIWorkflow.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55

66
public class OpenAPIWorkflow {
77

8-
private String workflowsSpec;
8+
private String arazzo;
99
private Info info;
1010
private List<SourceDescription> sourceDescriptions = new ArrayList<>();
1111
private List<Workflow> workflows = new ArrayList<>();
1212
private Components components;
1313

14-
public String getWorkflowsSpec() {
15-
return workflowsSpec;
14+
public String getArazzo() {
15+
return arazzo;
1616
}
1717

18-
public void setWorkflowsSpec(String workflowsSpec) {
19-
this.workflowsSpec = workflowsSpec;
18+
public void setArazzo(String arazzo) {
19+
this.arazzo = arazzo;
2020
}
2121

2222
public Info getInfo() {

src/main/java/com/apiflows/parser/OpenAPIWorkflowValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public OpenAPIWorkflowValidatorResult validate() {
3434

3535
OpenAPIWorkflowValidatorResult result = new OpenAPIWorkflowValidatorResult();
3636

37-
if (openAPIWorkflow.getWorkflowsSpec() == null || openAPIWorkflow.getWorkflowsSpec().isEmpty()) {
37+
if (openAPIWorkflow.getArazzo() == null || openAPIWorkflow.getArazzo().isEmpty()) {
3838
result.addError("'workflowsSpec' is undefined");
3939
}
4040

src/test/java/com/apiflows/parser/OpenAPIWorkflowParserTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ class OpenAPIWorkflowParserTest {
1010

1111
@Test
1212
void parseFromFile() {
13-
final String WORKFLOWS_SPEC_FILE = "src/test/resources/1.0.0/pet-coupons.workflow.yaml";
13+
final String WORKFLOWS_SPEC_FILE = "src/test/resources/1.0.0/pet-coupons.arazzo.yaml";
1414

1515
OpenAPIWorkflowParserResult result = parser.parse(WORKFLOWS_SPEC_FILE);
1616
assertNotNull(result.getOpenAPIWorkflow());
17-
assertEquals("1.0.0-prerelease", result.getOpenAPIWorkflow().getWorkflowsSpec());
17+
assertEquals("1.0.0", result.getOpenAPIWorkflow().getArazzo());
1818
assertNotNull(result.getOpenAPIWorkflow().getInfo());
1919
assertEquals("Petstore - Apply Coupons", result.getOpenAPIWorkflow().getInfo().getTitle());
2020
assertNotNull(result.getOpenAPIWorkflow().getComponents());
@@ -30,11 +30,11 @@ void parseFromFile() {
3030

3131
@Test
3232
void parseFromUrl() {
33-
final String WORKFLOWS_SPEC_FILE = "https://raw.githubusercontent.com/API-Flows/openapi-workflow-parser/main/src/test/resources/1.0.0/pet-coupons.workflow.yaml";
33+
final String WORKFLOWS_SPEC_FILE = "https://raw.githubusercontent.com/API-Flows/openapi-workflow-parser/main/src/test/resources/1.0.0/pet-coupons.arazzo.yaml";
3434

3535
OpenAPIWorkflowParserResult result = parser.parse(WORKFLOWS_SPEC_FILE);
3636
assertNotNull(result.getOpenAPIWorkflow());
37-
assertEquals("1.0.0-prerelease", result.getOpenAPIWorkflow().getWorkflowsSpec());
37+
assertEquals("1.0.0-prerelease", result.getOpenAPIWorkflow().getArazzo());
3838
assertNotNull(result.getOpenAPIWorkflow().getInfo());
3939
assertEquals("Petstore - Apply Coupons", result.getOpenAPIWorkflow().getInfo().getTitle());
4040
}
@@ -71,12 +71,12 @@ void parseFromJsonFile() {
7171
OpenAPIWorkflowParserResult result = parser.parse(WORKFLOWS_SPEC_FILE);
7272
assertTrue(result.isJson());
7373
assertNotNull(result.getOpenAPIWorkflow());
74-
assertEquals("1.0.0", result.getOpenAPIWorkflow().getWorkflowsSpec());
74+
assertEquals("1.0.0", result.getOpenAPIWorkflow().getArazzo());
7575
}
7676

7777
@Test
7878
public void isYaml() {
79-
final String WORKFLOWS_SPEC_FILE = "src/test/resources/1.0.0/pet-coupons.workflow.yaml";
79+
final String WORKFLOWS_SPEC_FILE = "src/test/resources/1.0.0/pet-coupons.arazzo.yaml";
8080

8181
OpenAPIWorkflowParserResult result = parser.parse(WORKFLOWS_SPEC_FILE);
8282
assertTrue(result.isYaml());

src/test/java/com/apiflows/parser/source/OperationBinderTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void getOperationsFromUrl() {
3535

3636
@Test
3737
void bind() {
38-
final String WORKFLOWS_SPEC_FILE = "src/test/resources/1.0.0/pet-coupons.workflow.yaml";
38+
final String WORKFLOWS_SPEC_FILE = "src/test/resources/1.0.0/pet-coupons.arazzo.yaml";
3939

4040
OpenAPIWorkflowParserResult result = new OpenAPIWorkflowParser().parse(WORKFLOWS_SPEC_FILE);
4141

@@ -58,7 +58,7 @@ void bind() {
5858

5959
@Test
6060
void bindFromUrl() {
61-
final String WORKFLOWS_SPEC_FILE = "https://raw.githubusercontent.com/OAI/sig-workflows/main/examples/1.0.0/pet-coupons.workflow.yaml";
61+
final String WORKFLOWS_SPEC_FILE = "https://raw.githubusercontent.com/API-Flows/openapi-workflow-parser/main/src/test/resources/1.0.0/pet-coupons.arazzo.yaml";
6262

6363
OpenAPIWorkflowParserResult result = new OpenAPIWorkflowParser().parse(WORKFLOWS_SPEC_FILE);
6464

src/test/java/com/apiflows/parser/source/WorkflowBinderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class WorkflowBinderTest {
1313

1414
@Test
1515
void bind() {
16-
final String WORKFLOWS_SPEC_FILE = "src/test/resources/1.0.0/pet-coupons.workflow.yaml";
16+
final String WORKFLOWS_SPEC_FILE = "src/test/resources/1.0.0/pet-coupons.arazzo.yaml";
1717

1818
OpenAPIWorkflowParserResult result = new OpenAPIWorkflowParser().parse(WORKFLOWS_SPEC_FILE);
1919

src/test/java/com/apiflows/parser/util/HttpUtilTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ class HttpUtilTest {
1010

1111
@Test
1212
void call() {
13-
final String WORKFLOWS_SPEC_URL = "https://github.com/OAI/sig-workflows/blob/main/examples/1.0.0/pet-coupons.workflow.yaml";
13+
final String WORKFLOWS_SPEC_URL = "https://raw.githubusercontent.com/API-Flows/openapi-workflow-parser/main/src/test/resources/1.0.0/pet-coupons.arazzo.yaml";
1414
assertNotNull(httpUtil.call(WORKFLOWS_SPEC_URL));
1515
}
1616

1717
@Test
1818
void isUrl() {
19-
final String WORKFLOWS_SPEC_URL = "https://github.com/OAI/sig-workflows/blob/main/examples/1.0.0/pet-coupons.workflow.yaml";
19+
final String WORKFLOWS_SPEC_URL = "https://raw.githubusercontent.com/API-Flows/openapi-workflow-parser/main/src/test/resources/1.0.0/pet-coupons.arazzo.yaml";
2020
assertTrue(httpUtil.isUrl(WORKFLOWS_SPEC_URL));
2121
}
2222
}

src/test/java/com/apiflows/parser/util/PathUtilTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ class PathUtilTest {
1010

1111
@Test
1212
void getFromFile() {
13-
final String WORKFLOWS_SPEC_FILE = "src/test/resources/1.0.0/pet-coupons.workflow.yaml";
13+
final String WORKFLOWS_SPEC_FILE = "src/test/resources/1.0.0/pet-coupons.arazzo.yaml";
1414
assertFalse(pathUtil.getFromFile(WORKFLOWS_SPEC_FILE).isEmpty());
1515
}
1616

1717
@Test
1818
void isFile() {
19-
final String WORKFLOWS_SPEC_FILE = "src/test/resources/1.0.0/pet-coupons.workflow.yaml";
19+
final String WORKFLOWS_SPEC_FILE = "src/test/resources/1.0.0/pet-coupons.arazzo.yaml";
2020
assertTrue(pathUtil.isFile(WORKFLOWS_SPEC_FILE));
2121
}
2222

src/test/resources/1.0.0/pet-coupons.workflow.yaml renamed to src/test/resources/1.0.0/pet-coupons.arazzo.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
workflowsSpec: 1.0.0-prerelease
1+
arazzo: 1.0.0
22
info:
33
title: Petstore - Apply Coupons
44
version: 1.0.0
@@ -70,9 +70,9 @@ workflows:
7070
- name: status
7171
in: query
7272
value: "available"
73-
- name: $components.parameters.page
73+
- reference: $components.parameters.page
7474
value: 1
75-
- name: $components.parameters.pageSize
75+
- reference: $components.parameters.pageSize
7676
value: 10
7777
successCriteria:
7878
- condition: $statusCode == 200

src/test/resources/1.0.0/simple.workflow.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
workflowsSpec: 1.0.0
1+
arazzo: 1.0.0
22
info:
33
title: simple
44
version: v1

0 commit comments

Comments
 (0)