mzielinski / spring-cloud-contract-oa3 Goto Github PK
View Code? Open in Web Editor NEWThis project forked from springframeworkguru/spring-cloud-contract-oa3
Spring Cloud Contract Open API 3.0
License: Apache License 2.0
This project forked from springframeworkguru/spring-cloud-contract-oa3
Spring Cloud Contract Open API 3.0
License: Apache License 2.0
Are you planning to push your releases to maven central?
Hello @mzielinski , I was wondering if it's feasible to employ spring-cloud-contract-oa3 with an OpenAPI specification that's in JSON format. While looking at the examples, I noticed that all the specification files were in YAML, and I couldn't find any that were in JSON
Use deprecated/contract_reference_request.yml
as a reference one for creating contract definition in oa3
Acceptance Criteria:
{{{ request.url }}}
)Use case:
We have hidden header, which should not be displayed in open-api specification, but contract and stub should support it.
Add tests which verifies that bodyFromFileAsBytes and bodyFromFile works properly. In case of some issue, fix implementation to support it in all use cases.
Currently there is a issue with query parameters in SCC which I fixed (when url instead urlpath is used) โ spring-cloud/spring-cloud-contract#1780, but it is not release yet.
Nevertheless, ssc-oa3 does not work as well, because there is not matchings for query parameters in produced yaml contract. Details: springframeworkguru#18
Acceptance Criteria:
Acceptance Criteria:
AsyncAPI is similar to OpenAPI: https://www.asyncapi.com/
We can check already created implementation by (Stmated@26af7da)
To reduce problem with groovy version in projects which will use it, it better to use Java instead of Groovy.
I'm using the spring-cloud-contract-oa3 v3.1.1.0 and it converts the path param of my endpoint as a query param in the generated tests. Am I specifying the contract wrong or is there a bug in spring-cloud-contract-oa3?
Here is an example of an OA3 yaml with path param:
openapi: 3.0.3
info:
title: Doughnuts
version: 0.0.1
description: |-
API to make doughnuts
servers:
- url: 'http://localhost:8080/'
description: Local
paths:
'/doughnuts/{doughnutId}':
parameters:
- schema:
type: string
example: PEANUT_BUTTER
name: doughnutId
in: path
required: true
description: Use doughnut to fetch details
x-contracts:
- contractId: 1
value: PEANUT_BUTTER
get:
summary: Get doughnut by doughnut Id
x-contracts:
- contractId: 1
name: Should return doughnut by id
responses:
'200':
description: Ok
content:
application/json:
schema:
$ref: '#/components/schemas/DoughnutDto'
x-contracts:
- contractId: 1
body:
doughnutId: "PEANUT_BUTTER"
cost: 1.99
headers:
Content-Type: application/json
components:
schemas:
DoughnutDto:
title: DoughnutDto
type: object
description: Doughnut data
properties:
doughnutId:
type: string
example: PEANUT_BUTTER
description: Doughnutu Identifier
cost:
type: number
description: doughnut cost
example: 1.99
required:
- doughnutId
- cost
Here is the generated test:
@Test
public void validate_should_return_doughnut_by_id() throws Exception {
// given:
MockMvcRequestSpecification request = given();
// when:
ResponseOptions response = given().spec(request)
.queryParam("doughnutId","PEANUT_BUTTER")
.get("/doughnuts/{doughnutId}");
// then:
assertThat(response.statusCode()).isEqualTo(200);
assertThat(response.header("Content-Type")).isEqualTo("application/json");
// and:
DocumentContext parsedJson = JsonPath.parse(response.getBody().asString());
assertThatJson(parsedJson).field("['doughnutId']").isEqualTo("PEANUT_BUTTER");
assertThatJson(parsedJson).field("['cost']").isEqualTo(1.99);
}
Acceptance Criteria:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.