Skip to content

Commit 0c1d4d2

Browse files
committed
docs: YAML autocompletion - 1.0.0
1 parent 0ec2bce commit 0c1d4d2

12 files changed

+359
-3
lines changed

src/test/kotlin/com/github/pakisan/arazzoideaplugin/extensions/completion/AbstractArazzoSpecificationCompletionContributorTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ abstract class AbstractArazzoSpecificationCompletionContributorTest: BasePlatfor
122122
fun `test $ - components - (double quote)s(double quote)`() {
123123
configureMyFixture("components - double quote s double quote.${fileExtension()}")
124124

125-
assertEquals(
126-
(`$ - components - s`).sorted(),
127-
(myFixture.lookupElementStrings?.sorted() ?: emptyList<String>())
125+
assertTrue(
126+
(myFixture.lookupElementStrings ?: emptyList<String>())
127+
.containsAll(`$ - components - s`)
128128
)
129129
}
130130

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.github.pakisan.arazzoideaplugin.extensions.completion.v1._0_0
2+
3+
import com.github.pakisan.arazzoideaplugin.extensions.completion.AbstractArazzoSpecificationCompletionContributorTest
4+
import com.github.pakisan.arazzoideaplugin.extensions.completion.ArazzoSpecificationCompletionContributor
5+
6+
/**
7+
* Abstract [ArazzoSpecificationCompletionContributor] test
8+
*
9+
* @author Pavel Bodiachevskii
10+
* @since 1.1.0
11+
*/
12+
class ArazzoSpecificationCompletionContributorYamlTest: AbstractArazzoSpecificationCompletionContributorTest() {
13+
14+
override fun fileExtension(): String = "yaml"
15+
16+
override fun arazzoVersion(): String = "1.0.0"
17+
18+
override val `$ - i`: List<String> = super.`$ - i`.sorted().map { it.replace("\"", "") }
19+
20+
override val `$ - info - i`: List<String> = listOf("description", "info", "title", "version")
21+
22+
override val `$ - sourceDescriptions - e`: List<String> = listOf("name", "sourceDescriptions", "type")
23+
24+
override val `$ - workflows - workflow - s` = super.`$ - workflows - workflow - s`.map { it.replace("\"", "") }
25+
26+
override val `$ - components - s`: List<String> = super.`$ - components - s`.sorted().map { it.replace("\"", "") }
27+
28+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
arazzo: 1.0.0
2+
info:
3+
title: Petstore - Apply Coupons
4+
version: 1.0.0
5+
description: >-
6+
Illustrates a workflow whereby a client a) finds a pet in the petstore, b)
7+
finds coupons for that pet, and finally c) orders the pet while applying the
8+
coupons from step b.
9+
sourceDescriptions:
10+
- name: pet-coupons
11+
url: ./pet-coupons.openapi.yaml
12+
type: openapi
13+
workflows:
14+
- workflowId: apply-coupon
15+
summary: Apply a coupon to a pet order.
16+
description: >-
17+
This is how you can find a pet, find an applicable coupon, and apply that
18+
coupon in your order. The workflow concludes by outputting the ID of the
19+
placed order.
20+
inputs:
21+
$ref: '#/components/inputs/apply_coupon_input'
22+
steps:
23+
- stepId: find-pet
24+
description: Find a pet based on the provided tags.
25+
operationId: findPetsByTags
26+
parameters:
27+
- name: pet_tags
28+
in: query
29+
value: $inputs.my_pet_tags
30+
successCriteria:
31+
- condition: $statusCode == 200
32+
outputs:
33+
my_pet_id: '$response.body#/0/id'
34+
- stepId: find-coupons
35+
description: Find a coupon available for the selected pet.
36+
operationId: getPetCoupons
37+
parameters:
38+
- name: pet_id
39+
in: path
40+
value: $steps.find-pet.outputs.my_pet_id
41+
successCriteria:
42+
- condition: $statusCode == 200
43+
outputs:
44+
my_coupon_code: '$response.body#/couponCode'
45+
- stepId: place-order
46+
description: 'Place an order for the pet, applying the coupon.'
47+
workflowId: place-order
48+
parameters:
49+
- name: pet_id
50+
value: $steps.find-pet.outputs.my_pet_id
51+
- name: coupon_code
52+
value: $steps.find-coupons.outputs.my_coupon_code
53+
successCriteria:
54+
- condition: $statusCode == 200
55+
outputs:
56+
my_order_id: $outputs.workflow_order_id
57+
outputs:
58+
apply_coupon_pet_order_id: $steps.place-order.outputs.my_order_id
59+
components:
60+
"s<caret>"
61+
inputs:
62+
apply_coupon_input:
63+
type: object
64+
properties:
65+
my_pet_tags:
66+
type: array
67+
items:
68+
type: string
69+
description: >-
70+
Desired tags to use when searching for a pet, in CSV format (e.g.
71+
"puppy, dalmatian")
72+
store_id:
73+
$ref: '#/components/inputs/store_id'
74+
store_id:
75+
type: string
76+
description: >-
77+
Indicates the domain name of the store where the customer is browsing or
78+
buying pets, e.g. "pets.example.com" or "pets.example.co.uk".
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
arazzo: 1.0.0
2+
info:
3+
title: Petstore - Apply Coupons
4+
version: 1.0.0
5+
description: >-
6+
Illustrates a workflow whereby a client a) finds a pet in the petstore, b)
7+
finds coupons for that pet, and finally c) orders the pet while applying the
8+
coupons from step b.
9+
sourceDescriptions:
10+
- name: pet-coupons
11+
url: ./pet-coupons.openapi.yaml
12+
type: openapi
13+
workflows:
14+
- workflowId: apply-coupon
15+
summary: Apply a coupon to a pet order.
16+
description: >-
17+
This is how you can find a pet, find an applicable coupon, and apply that
18+
coupon in your order. The workflow concludes by outputting the ID of the
19+
placed order.
20+
inputs:
21+
$ref: '#/components/inputs/apply_coupon_input'
22+
steps:
23+
- stepId: find-pet
24+
description: Find a pet based on the provided tags.
25+
operationId: findPetsByTags
26+
parameters:
27+
- name: pet_tags
28+
in: query
29+
value: $inputs.my_pet_tags
30+
successCriteria:
31+
- condition: $statusCode == 200
32+
outputs:
33+
my_pet_id: '$response.body#/0/id'
34+
- stepId: find-coupons
35+
description: Find a coupon available for the selected pet.
36+
operationId: getPetCoupons
37+
parameters:
38+
- name: pet_id
39+
in: path
40+
value: $steps.find-pet.outputs.my_pet_id
41+
successCriteria:
42+
- condition: $statusCode == 200
43+
outputs:
44+
my_coupon_code: '$response.body#/couponCode'
45+
- stepId: place-order
46+
description: 'Place an order for the pet, applying the coupon.'
47+
workflowId: place-order
48+
parameters:
49+
- name: pet_id
50+
value: $steps.find-pet.outputs.my_pet_id
51+
- name: coupon_code
52+
value: $steps.find-coupons.outputs.my_coupon_code
53+
successCriteria:
54+
- condition: $statusCode == 200
55+
outputs:
56+
my_order_id: $outputs.workflow_order_id
57+
outputs:
58+
apply_coupon_pet_order_id: $steps.place-order.outputs.my_order_id
59+
components:
60+
"s<caret>"
61+
inputs:
62+
apply_coupon_input:
63+
type: object
64+
properties:
65+
my_pet_tags:
66+
type: array
67+
items:
68+
type: string
69+
description: >-
70+
Desired tags to use when searching for a pet, in CSV format (e.g.
71+
"puppy, dalmatian")
72+
store_id:
73+
$ref: '#/components/inputs/store_id'
74+
store_id:
75+
type: string
76+
description: >-
77+
Indicates the domain name of the store where the customer is browsing or
78+
buying pets, e.g. "pets.example.com" or "pets.example.co.uk".
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
arazzo: 1.0.0
2+
"i<caret>"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
arazzo: 1.0.0
2+
i<caret>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
arazzo: 1.0.0
2+
info:
3+
"i<caret>"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
arazzo: 1.0.0
2+
info:
3+
i<caret>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
arazzo: 1.0.0
2+
sourceDescriptions:
3+
- e<caret>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
arazzo: 1.0.0
2+
sourceDescriptions:
3+
- e<caret>

0 commit comments

Comments
 (0)