-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
418 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
core/src/test/java/org/openapitools/openapidiff/core/ExternalRefsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.openapitools.openapidiff.core; | ||
|
||
import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiAreEquals; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public class ExternalRefsTest { | ||
@Test | ||
public void testDiffSame() { | ||
assertOpenApiAreEquals( | ||
"issue-464/source/specification/openapi.yaml", | ||
"issue-464/destination/specification/openapi.yaml"); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
core/src/test/resources/issue-464/destination/specification/common/examples/200-health.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
status: up | ||
date_time: "2021-09-04T21:00:00Z" | ||
api_name: api | ||
api_version: 1.1.2 |
5 changes: 5 additions & 0 deletions
5
core/src/test/resources/issue-464/destination/specification/common/examples/400.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type: /problem/bad-request | ||
title: Bad Request | ||
status: 400 | ||
detail: Invalid or malformed request syntax | ||
instance: /problem/bad-request#invalid-or-malformed-request-syntax |
5 changes: 5 additions & 0 deletions
5
core/src/test/resources/issue-464/destination/specification/common/examples/404.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type: /problem/data-not-found | ||
title: Data not found | ||
status: 404 | ||
detail: Requested data not found | ||
instance: /problem/data-not-found#requested-data-not-found |
5 changes: 5 additions & 0 deletions
5
core/src/test/resources/issue-464/destination/specification/common/examples/500.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type: /problem/internal-server-error | ||
title: Internal Server Error | ||
status: 500 | ||
detail: A technical exception occurred within the application | ||
instance: /problem/internal-server-error#a-technical-exception-occurred-within-the-application |
3 changes: 3 additions & 0 deletions
3
...s/issue-464/destination/specification/common/examples/Product/200-GetProductResponse.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
products: | ||
- id: Prod-000001 | ||
status: Active |
9 changes: 9 additions & 0 deletions
9
.../test/resources/issue-464/destination/specification/common/models/GetProductResponse.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
type: object | ||
description: Model for response from call to GET products requiring an array of products to be returned. | ||
title: GetProductResponse | ||
properties: | ||
Products: | ||
type: array | ||
items: | ||
$ref: Product.yaml | ||
|
15 changes: 15 additions & 0 deletions
15
core/src/test/resources/issue-464/destination/specification/common/models/Product.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
type: object | ||
description: Product Data Model | ||
title: '' | ||
properties: | ||
id: | ||
type: string | ||
example: Prod-00001 | ||
description: An unique Id of product record | ||
status: | ||
type: string | ||
example: Active | ||
enum: | ||
- Active | ||
- Expired | ||
description: Defines the current status of the product |
34 changes: 34 additions & 0 deletions
34
core/src/test/resources/issue-464/destination/specification/common/models/error.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
type: object | ||
properties: | ||
type: | ||
type: string | ||
format: uri-reference | ||
description: | | ||
A URI reference that uniquely identifies the problem type only in the context of the provided API. Opposed to the specification in RFC-7807, it is neither recommended to be dereferenceable and point to a human-readable documentation nor globally unique for the problem type. | ||
default: about:blank | ||
example: /problem/connection-error | ||
title: | ||
type: string | ||
description: | | ||
A short summary of the problem type. Written in English and readable for engineers, usually not suited for non technical stakeholders and not localized. | ||
example: Service Unavailable | ||
status: | ||
type: integer | ||
format: int32 | ||
description: | | ||
The HTTP status code generated by the origin server for this occurrence of the problem. | ||
minimum: 100 | ||
maximum: 600 | ||
exclusiveMaximum: true | ||
example: 503 | ||
detail: | ||
type: string | ||
description: | | ||
A human readable explanation specific to this occurrence of the problem that is helpful to locate the problem and give advice on how to proceed. Written in English and readable for engineers, usually not suited for non technical stakeholders and not localized. | ||
example: Connection to database timed out | ||
instance: | ||
type: string | ||
format: uri-reference | ||
description: | | ||
A URI reference that identifies the specific occurrence of the problem, e.g. by adding a fragment identifier or sub-path to the problem type. May be used to locate the root of this problem in the source code. | ||
example: /problem/connection-error#token-info-read-timed-out |
6 changes: 6 additions & 0 deletions
6
.../test/resources/issue-464/destination/specification/common/parameters/correlation-id.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
name: correlation-id | ||
in: header | ||
schema: | ||
type: string | ||
example: 4cbc91f7-11d3-4019-a92b-64a54964b470 | ||
description: A unique identifier attached to request and responses as header that allows reference to a particular transaction or chain of transactions. Based on UUID conforming to RFC 4122 - https://datatracker.ietf.org/doc/html/rfc4122 |
6 changes: 6 additions & 0 deletions
6
...src/test/resources/issue-464/destination/specification/common/parameters/traceparent.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
name: traceparent | ||
in: header | ||
schema: | ||
type: string | ||
example: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01 | ||
description: The traceparent HTTP header field identifies the incoming request in a tracing system. Conforming to OpenTelemetry (OTel) Trace Context |
110 changes: 110 additions & 0 deletions
110
core/src/test/resources/issue-464/destination/specification/openapi.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: service/someapi/v1 | ||
version: 1.1.2 | ||
contact: | ||
name: john.doe | ||
email: [email protected] | ||
description: Provide description of the API | ||
servers: | ||
- url: 'https://api.acme.com/service/someapi/v1' | ||
paths: | ||
/products: | ||
get: | ||
summary: Query Products | ||
operationId: get-products | ||
responses: | ||
'200': | ||
$ref: '#/components/responses/200-GetProductResponse' | ||
'400': | ||
$ref: '#/components/responses/400' | ||
'404': | ||
$ref: '#/components/responses/404' | ||
'500': | ||
$ref: '#/components/responses/500' | ||
description: Get Product Records | ||
parameters: | ||
- $ref: ./common/parameters/correlation-id.yaml | ||
- $ref: ./common/parameters/traceparent.yaml | ||
tags: | ||
- applicant | ||
components: | ||
schemas: | ||
Error: | ||
$ref: common/models/error.yaml | ||
GetProductResponse: | ||
$ref: ./common/models/GetProductResponse.yaml | ||
securitySchemes: | ||
Oauth: | ||
type: oauth2 | ||
description: Oauth Security Token Enforcement for internal production environment. | ||
flows: | ||
clientCredentials: | ||
tokenUrl: 'https://api.acme.com/auth/app/v1/token' | ||
scopes: | ||
scope: READ | ||
responses: | ||
'400': | ||
description: 400 Bad Request | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Error' | ||
examples: | ||
400 Bad Request: | ||
value: | ||
$ref: common/examples/400.yaml | ||
headers: | ||
correlation-id: | ||
schema: | ||
type: string | ||
description: An ID passed by clients to correlate multiple API requests. | ||
'404': | ||
description: 404 Not Found | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Error' | ||
examples: | ||
404 Not Found: | ||
value: | ||
$ref: common/examples/404.yaml | ||
headers: | ||
correlation-id: | ||
schema: | ||
type: string | ||
description: An ID passed by clients to correlate multiple API requests. | ||
'500': | ||
description: 500 Internal Server Error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Error' | ||
examples: | ||
500 Internal Server Error: | ||
value: | ||
$ref: common/examples/500.yaml | ||
headers: | ||
correlation-id: | ||
schema: | ||
type: string | ||
description: An ID passed by clients to correlate multiple API requests. | ||
200-GetProductResponse: | ||
description: Get Product Response | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/GetProductResponse' | ||
examples: | ||
200 - Sample Data: | ||
value: | ||
$ref: common/examples/Product/200-GetProductResponse.yaml | ||
headers: | ||
correlation-id: | ||
schema: | ||
type: string | ||
description: An ID passed by clients to correlate multiple API requests. | ||
security: | ||
- Oauth: [] | ||
tags: | ||
- name: applicant |
4 changes: 4 additions & 0 deletions
4
core/src/test/resources/issue-464/source/specification/common/examples/200-health.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
status: up | ||
date_time: "2021-09-04T21:00:00Z" | ||
api_name: api | ||
api_version: 1.1.2 |
5 changes: 5 additions & 0 deletions
5
core/src/test/resources/issue-464/source/specification/common/examples/400.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type: /problem/bad-request | ||
title: Bad Request | ||
status: 400 | ||
detail: Invalid or malformed request syntax | ||
instance: /problem/bad-request#invalid-or-malformed-request-syntax |
5 changes: 5 additions & 0 deletions
5
core/src/test/resources/issue-464/source/specification/common/examples/404.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type: /problem/data-not-found | ||
title: Data not found | ||
status: 404 | ||
detail: Requested data not found | ||
instance: /problem/data-not-found#requested-data-not-found |
5 changes: 5 additions & 0 deletions
5
core/src/test/resources/issue-464/source/specification/common/examples/500.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type: /problem/internal-server-error | ||
title: Internal Server Error | ||
status: 500 | ||
detail: A technical exception occurred within the application | ||
instance: /problem/internal-server-error#a-technical-exception-occurred-within-the-application |
3 changes: 3 additions & 0 deletions
3
...ources/issue-464/source/specification/common/examples/Product/200-GetProductResponse.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
products: | ||
- id: Prod-000001 | ||
status: Active |
9 changes: 9 additions & 0 deletions
9
core/src/test/resources/issue-464/source/specification/common/models/GetProductResponse.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
type: object | ||
description: Model for response from call to GET products requiring an array of products to be returned. | ||
title: GetProductResponse | ||
properties: | ||
Products: | ||
type: array | ||
items: | ||
$ref: Product.yaml | ||
|
15 changes: 15 additions & 0 deletions
15
core/src/test/resources/issue-464/source/specification/common/models/Product.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
type: object | ||
description: Product Data Model | ||
title: '' | ||
properties: | ||
id: | ||
type: string | ||
example: Prod-00001 | ||
description: An unique Id of product record | ||
status: | ||
type: string | ||
example: Active | ||
enum: | ||
- Active | ||
- Expired | ||
description: Defines the current status of the product |
34 changes: 34 additions & 0 deletions
34
core/src/test/resources/issue-464/source/specification/common/models/error.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
type: object | ||
properties: | ||
type: | ||
type: string | ||
format: uri-reference | ||
description: | | ||
A URI reference that uniquely identifies the problem type only in the context of the provided API. Opposed to the specification in RFC-7807, it is neither recommended to be dereferenceable and point to a human-readable documentation nor globally unique for the problem type. | ||
default: about:blank | ||
example: /problem/connection-error | ||
title: | ||
type: string | ||
description: | | ||
A short summary of the problem type. Written in English and readable for engineers, usually not suited for non technical stakeholders and not localized. | ||
example: Service Unavailable | ||
status: | ||
type: integer | ||
format: int32 | ||
description: | | ||
The HTTP status code generated by the origin server for this occurrence of the problem. | ||
minimum: 100 | ||
maximum: 600 | ||
exclusiveMaximum: true | ||
example: 503 | ||
detail: | ||
type: string | ||
description: | | ||
A human readable explanation specific to this occurrence of the problem that is helpful to locate the problem and give advice on how to proceed. Written in English and readable for engineers, usually not suited for non technical stakeholders and not localized. | ||
example: Connection to database timed out | ||
instance: | ||
type: string | ||
format: uri-reference | ||
description: | | ||
A URI reference that identifies the specific occurrence of the problem, e.g. by adding a fragment identifier or sub-path to the problem type. May be used to locate the root of this problem in the source code. | ||
example: /problem/connection-error#token-info-read-timed-out |
6 changes: 6 additions & 0 deletions
6
core/src/test/resources/issue-464/source/specification/common/parameters/correlation-id.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
name: correlation-id | ||
in: header | ||
schema: | ||
type: string | ||
example: 4cbc91f7-11d3-4019-a92b-64a54964b470 | ||
description: A unique identifier attached to request and responses as header that allows reference to a particular transaction or chain of transactions. Based on UUID conforming to RFC 4122 - https://datatracker.ietf.org/doc/html/rfc4122 |
6 changes: 6 additions & 0 deletions
6
core/src/test/resources/issue-464/source/specification/common/parameters/traceparent.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
name: traceparent | ||
in: header | ||
schema: | ||
type: string | ||
example: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01 | ||
description: The traceparent HTTP header field identifies the incoming request in a tracing system. Conforming to OpenTelemetry (OTel) Trace Context |
Oops, something went wrong.