Skip to content

Commit 644b7b0

Browse files
committed
use bundled folder naming, fix build:specs command
1 parent 012ed1b commit 644b7b0

18 files changed

+41
-44
lines changed

.github/actions/cache/action.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,63 +44,63 @@ runs:
4444
uses: actions/cache@v2
4545
with:
4646
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/packages/client-search/dist
47-
key: ${{ runner.os }}-1-js-client-search-${{ hashFiles('clients/algoliasearch-client-javascript/packages/client-search/**') }}-${{ hashFiles('specs/dist/search.yml') }}
47+
key: ${{ runner.os }}-1-js-client-search-${{ hashFiles('clients/algoliasearch-client-javascript/packages/client-search/**') }}-${{ hashFiles('specs/bundled/search.yml') }}
4848

4949
- name: Restore built JavaScript recommend client
5050
if: ${{ inputs.job == 'cts' }}
5151
uses: actions/cache@v2
5252
with:
5353
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/packages/recommend/dist
54-
key: ${{ runner.os }}-1-js-client-recommend-${{ hashFiles('clients/algoliasearch-client-javascript/packages/recommend/**') }}-${{ hashFiles('specs/dist/recommend.yml') }}
54+
key: ${{ runner.os }}-1-js-client-recommend-${{ hashFiles('clients/algoliasearch-client-javascript/packages/recommend/**') }}-${{ hashFiles('specs/bundled/recommend.yml') }}
5555

5656
- name: Restore built JavaScript query-suggestions client
5757
if: ${{ inputs.job == 'cts' }}
5858
uses: actions/cache@v2
5959
with:
6060
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/packages/client-query-suggestions/dist
61-
key: ${{ runner.os }}-1-js-client-query-suggestions-${{ hashFiles('clients/algoliasearch-client-javascript/packages/client-query-suggestions/**') }}-${{ hashFiles('specs/dist/query-suggestions.yml') }}
61+
key: ${{ runner.os }}-1-js-client-query-suggestions-${{ hashFiles('clients/algoliasearch-client-javascript/packages/client-query-suggestions/**') }}-${{ hashFiles('specs/bundled/query-suggestions.yml') }}
6262

6363
- name: Restore built JavaScript personalization client
6464
if: ${{ inputs.job == 'cts' }}
6565
uses: actions/cache@v2
6666
with:
6767
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/packages/client-personalization/dist
68-
key: ${{ runner.os }}-1-js-client-personalization-${{ hashFiles('clients/algoliasearch-client-javascript/packages/client-personalization/**') }}-${{ hashFiles('specs/dist/personalization.yml') }}
68+
key: ${{ runner.os }}-1-js-client-personalization-${{ hashFiles('clients/algoliasearch-client-javascript/packages/client-personalization/**') }}-${{ hashFiles('specs/bundled/personalization.yml') }}
6969

7070
- name: Restore built JavaScript analytics client
7171
if: ${{ inputs.job == 'cts' }}
7272
uses: actions/cache@v2
7373
with:
7474
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/packages/client-analytics/dist
75-
key: ${{ runner.os }}-1-js-client-analytics-${{ hashFiles('clients/algoliasearch-client-javascript/packages/client-analytics/**') }}-${{ hashFiles('specs/dist/analytics.yml') }}
75+
key: ${{ runner.os }}-1-js-client-analytics-${{ hashFiles('clients/algoliasearch-client-javascript/packages/client-analytics/**') }}-${{ hashFiles('specs/bundled/analytics.yml') }}
7676

7777
- name: Restore built JavaScript abtesting client
7878
if: ${{ inputs.job == 'cts' }}
7979
uses: actions/cache@v2
8080
with:
8181
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/packages/client-abtesting/dist
82-
key: ${{ runner.os }}-1-js-client-abtesting-${{ hashFiles('clients/algoliasearch-client-javascript/packages/client-abtesting/**') }}-${{ hashFiles('specs/dist/abtesting.yml') }}
82+
key: ${{ runner.os }}-1-js-client-abtesting-${{ hashFiles('clients/algoliasearch-client-javascript/packages/client-abtesting/**') }}-${{ hashFiles('specs/bundled/abtesting.yml') }}
8383

8484
- name: Restore built JavaScript insights client
8585
if: ${{ inputs.job == 'cts' }}
8686
uses: actions/cache@v2
8787
with:
8888
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/packages/client-insights/dist
89-
key: ${{ runner.os }}-1-js-client-insights-${{ hashFiles('clients/algoliasearch-client-javascript/packages/client-insights/**') }}-${{ hashFiles('specs/dist/insights.yml') }}
89+
key: ${{ runner.os }}-1-js-client-insights-${{ hashFiles('clients/algoliasearch-client-javascript/packages/client-insights/**') }}-${{ hashFiles('specs/bundled/insights.yml') }}
9090

9191
- name: Restore built JavaScript sources client
9292
if: ${{ inputs.job == 'cts' }}
9393
uses: actions/cache@v2
9494
with:
9595
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/packages/client-sources/dist
96-
key: ${{ runner.os }}-1-js-client-sources-${{ hashFiles('clients/algoliasearch-client-javascript/packages/client-sources/**') }}-${{ hashFiles('specs/dist/sources.yml') }}
96+
key: ${{ runner.os }}-1-js-client-sources-${{ hashFiles('clients/algoliasearch-client-javascript/packages/client-sources/**') }}-${{ hashFiles('specs/bundled/sources.yml') }}
9797

9898
- name: Restore built Java client
9999
if: ${{ inputs.job == 'cts' }}
100100
uses: actions/cache@v2
101101
with:
102102
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-java-2/target
103-
key: ${{ runner.os }}-1-java-client-${{ hashFiles('clients/algoliasearch-client-java-2/**') }}-${{ hashFiles('specs/dist/search.yml') }}
103+
key: ${{ runner.os }}-1-java-client-${{ hashFiles('clients/algoliasearch-client-java-2/**') }}-${{ hashFiles('specs/bundled/search.yml') }}
104104

105105
# setup yarn
106106
- name: Get yarn cache directory path

.github/workflows/check.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
run: yarn build:specs ${{ matrix.client }}
6060

6161
- name: Check diff with pushed spec
62-
run: exit $(git status --porcelain specs/dist/${{ matrix.client }}.yml | wc -l)
62+
run: exit $(git status --porcelain specs/bundled/${{ matrix.client }}.yml | wc -l)
6363

6464
client_javascript:
6565
timeout-minutes: 10
@@ -84,7 +84,7 @@ jobs:
8484
uses: actions/cache@v2
8585
with:
8686
path: '/home/runner/work/api-clients-automation/api-clients-automation/${{ matrix.client.folder }}/dist'
87-
key: ${{ runner.os }}-1-js-client-${{ matrix.client.name }}-${{ hashFiles(format('{0}/**', matrix.client.folder)) }}-${{ hashFiles(format('specs/dist/{0}.yml', matrix.client.name)) }}
87+
key: ${{ runner.os }}-1-js-client-${{ matrix.client.name }}-${{ hashFiles(format('{0}/**', matrix.client.folder)) }}-${{ hashFiles(format('specs/bundled/{0}.yml', matrix.client.name)) }}
8888

8989
- name: Generate ${{ matrix.client.name }} client
9090
if: steps.cache.outputs.cache-hit != 'true'
@@ -122,7 +122,7 @@ jobs:
122122
uses: actions/cache@v2
123123
with:
124124
path: '/home/runner/work/api-clients-automation/api-clients-automation/${{ matrix.client.folder }}/target'
125-
key: ${{ runner.os }}-1-java-client-${{ matrix.client.name }}-${{ hashFiles(format('{0}/**', matrix.client.folder)) }}-${{ hashFiles(format('specs/dist/{0}.yml', matrix.client.name)) }}
125+
key: ${{ runner.os }}-1-java-client-${{ matrix.client.name }}-${{ hashFiles(format('{0}/**', matrix.client.folder)) }}-${{ hashFiles(format('specs/bundled/{0}.yml', matrix.client.name)) }}
126126

127127
- name: Generate ${{ matrix.client.name }} client
128128
if: steps.cache.outputs.cache-hit != 'true'

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,5 @@ target
1818
build
1919

2020
dist
21-
!specs/dist
22-
specs/dist/*.cache
2321

2422
.openapi-generator

doc/CTS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ The test generation script requires a JSON file name from the `operationId` (e.g
4646
"searchParam": {
4747
"$objectName": "the name of the object for strongly type language, should be on every 'object' type (can be 'Object' if free-form)",
4848
"query": "the string to search",
49-
"acl": {
49+
"acl": {
5050
"$enumType": "the name of the enum object if marked as enum in the spec",
51-
"value": "the string value of the enum",
51+
"value": "the string value of the enum"
5252
}
5353
}
5454
},
@@ -117,6 +117,6 @@ When writing your template, here is a list of variables accessible from `mustach
117117
To get the list of `operationId` not yet in the CTS but in the spec, run this command:
118118

119119
```bash
120-
rm -rf ./specs/dist
120+
rm -rf ./specs/bundled
121121
comm -3 <(grep -r operationId ./specs | awk -F: '{gsub(/ /,""); print $NF}' | sort) <(find ./tests/CTS/clients -type f -name '*.json' | awk -F/ '{gsub(/.json/,"");print $NF}' | sort)
122122
```

openapitools.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"config": "#{cwd}/openapitools.json",
1010
"apiPackage": "src",
1111
"output": "#{cwd}/clients/algoliasearch-client-javascript/packages/client-search",
12-
"glob": "specs/dist/search.yml",
12+
"glob": "specs/bundled/search.yml",
1313
"gitHost": "algolia",
1414
"gitUserId": "algolia",
1515
"gitRepoId": "algoliasearch-client-javascript",
@@ -30,7 +30,7 @@
3030
"config": "#{cwd}/openapitools.json",
3131
"apiPackage": "src",
3232
"output": "#{cwd}/clients/algoliasearch-client-javascript/packages/recommend",
33-
"glob": "specs/dist/recommend.yml",
33+
"glob": "specs/bundled/recommend.yml",
3434
"gitHost": "algolia",
3535
"gitUserId": "algolia",
3636
"gitRepoId": "algoliasearch-client-javascript",
@@ -51,7 +51,7 @@
5151
"config": "#{cwd}/openapitools.json",
5252
"apiPackage": "src",
5353
"output": "#{cwd}/clients/algoliasearch-client-javascript/packages/client-personalization",
54-
"glob": "specs/dist/personalization.yml",
54+
"glob": "specs/bundled/personalization.yml",
5555
"gitHost": "algolia",
5656
"gitUserId": "algolia",
5757
"gitRepoId": "algoliasearch-client-javascript",
@@ -75,7 +75,7 @@
7575
"config": "#{cwd}/openapitools.json",
7676
"apiPackage": "src",
7777
"output": "#{cwd}/clients/algoliasearch-client-javascript/packages/client-analytics",
78-
"glob": "specs/dist/analytics.yml",
78+
"glob": "specs/bundled/analytics.yml",
7979
"gitHost": "algolia",
8080
"gitUserId": "algolia",
8181
"gitRepoId": "algoliasearch-client-javascript",
@@ -100,7 +100,7 @@
100100
"config": "#{cwd}/openapitools.json",
101101
"apiPackage": "src",
102102
"output": "#{cwd}/clients/algoliasearch-client-javascript/packages/client-insights",
103-
"glob": "specs/dist/insights.yml",
103+
"glob": "specs/bundled/insights.yml",
104104
"gitHost": "algolia",
105105
"gitUserId": "algolia",
106106
"gitRepoId": "algoliasearch-client-javascript",
@@ -125,7 +125,7 @@
125125
"config": "#{cwd}/openapitools.json",
126126
"apiPackage": "src",
127127
"output": "#{cwd}/clients/algoliasearch-client-javascript/packages/client-abtesting",
128-
"glob": "specs/dist/abtesting.yml",
128+
"glob": "specs/bundled/abtesting.yml",
129129
"gitHost": "algolia",
130130
"gitUserId": "algolia",
131131
"gitRepoId": "algoliasearch-client-javascript",
@@ -150,7 +150,7 @@
150150
"config": "#{cwd}/openapitools.json",
151151
"apiPackage": "src",
152152
"output": "#{cwd}/clients/algoliasearch-client-javascript/packages/client-query-suggestions",
153-
"glob": "specs/dist/query-suggestions.yml",
153+
"glob": "specs/bundled/query-suggestions.yml",
154154
"gitHost": "algolia",
155155
"gitUserId": "algolia",
156156
"gitRepoId": "algoliasearch-client-javascript",
@@ -174,7 +174,7 @@
174174
"config": "#{cwd}/openapitools.json",
175175
"apiPackage": "src",
176176
"output": "#{cwd}/clients/algoliasearch-client-javascript/packages/client-sources",
177-
"glob": "specs/dist/sources.yml",
177+
"glob": "specs/bundled/sources.yml",
178178
"gitHost": "algolia",
179179
"gitUserId": "algolia",
180180
"gitRepoId": "algoliasearch-client-javascript",
@@ -203,7 +203,7 @@
203203
"invokerPackage": "com.algolia",
204204
"modelPackage": "com.algolia.model",
205205
"library": "okhttp-gson",
206-
"glob": "specs/dist/search.yml",
206+
"glob": "specs/bundled/search.yml",
207207
"gitHost": "algolia",
208208
"gitUserId": "algolia",
209209
"gitRepoId": "algoliasearch-client-java-2",
@@ -219,7 +219,7 @@
219219
"templateDir": "#{cwd}/templates/php/",
220220
"config": "#{cwd}/openapitools.json",
221221
"output": "#{cwd}/clients/algoliasearch-client-php",
222-
"glob": "specs/dist/search.yml",
222+
"glob": "specs/bundled/search.yml",
223223
"gitHost": "algolia",
224224
"gitUserId": "algolia",
225225
"gitRepoId": "algoliasearch-client-php",
@@ -237,7 +237,7 @@
237237
"templateDir": "#{cwd}/templates/php/",
238238
"config": "#{cwd}/openapitools.json",
239239
"output": "#{cwd}/clients/algoliasearch-client-php",
240-
"glob": "specs/dist/recommend.yml",
240+
"glob": "specs/bundled/recommend.yml",
241241
"gitHost": "algolia",
242242
"gitUserId": "algolia",
243243
"gitRepoId": "algoliasearch-client-php",
@@ -255,7 +255,7 @@
255255
"templateDir": "#{cwd}/templates/php/",
256256
"config": "#{cwd}/openapitools.json",
257257
"output": "#{cwd}/clients/algoliasearch-client-php",
258-
"glob": "specs/dist/personalization.yml",
258+
"glob": "specs/bundled/personalization.yml",
259259
"gitHost": "algolia",
260260
"gitUserId": "algolia",
261261
"gitRepoId": "algoliasearch-client-php",
@@ -277,7 +277,7 @@
277277
"templateDir": "#{cwd}/templates/php/",
278278
"config": "#{cwd}/openapitools.json",
279279
"output": "#{cwd}/clients/algoliasearch-client-php",
280-
"glob": "specs/dist/analytics.yml",
280+
"glob": "specs/bundled/analytics.yml",
281281
"gitHost": "algolia",
282282
"gitUserId": "algolia",
283283
"gitRepoId": "algoliasearch-client-php",
@@ -300,7 +300,7 @@
300300
"templateDir": "#{cwd}/templates/php/",
301301
"config": "#{cwd}/openapitools.json",
302302
"output": "#{cwd}/clients/algoliasearch-client-php",
303-
"glob": "specs/dist/insights.yml",
303+
"glob": "specs/bundled/insights.yml",
304304
"gitHost": "algolia",
305305
"gitUserId": "algolia",
306306
"gitRepoId": "algoliasearch-client-php",
@@ -323,7 +323,7 @@
323323
"templateDir": "#{cwd}/templates/php/",
324324
"config": "#{cwd}/openapitools.json",
325325
"output": "#{cwd}/clients/algoliasearch-client-php",
326-
"glob": "specs/dist/abtesting.yml",
326+
"glob": "specs/bundled/abtesting.yml",
327327
"gitHost": "algolia",
328328
"gitUserId": "algolia",
329329
"gitRepoId": "algoliasearch-client-php",
@@ -346,7 +346,7 @@
346346
"templateDir": "#{cwd}/templates/php/",
347347
"config": "#{cwd}/openapitools.json",
348348
"output": "#{cwd}/clients/algoliasearch-client-php",
349-
"glob": "specs/dist/query-suggestions.yml",
349+
"glob": "specs/bundled/query-suggestions.yml",
350350
"gitHost": "algolia",
351351
"gitUserId": "algolia",
352352
"gitRepoId": "algoliasearch-client-php",

scripts/builds/specs.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ check_format_spec() {
2525

2626
build_spec() {
2727
local client=$1
28-
yarn openapi bundle specs/${client}/spec.yml -o specs/dist/${client}.${OUTPUT} --ext ${OUTPUT}
28+
yarn openapi bundle specs/${client}/spec.yml -o specs/bundled/${client}.${OUTPUT} --ext ${OUTPUT}
2929
echo ""
3030
}
3131

3232
validate_output_spec() {
3333
local client=$1
34-
yarn openapi lint specs/dist/${client}.${OUTPUT}
34+
yarn openapi lint specs/bundled/${client}.${OUTPUT}
3535
echo ""
3636
}
3737

38-
CLIENTS=$(find specs/*/spec.yml | awk -F / '{ print $(NF-1) }')
38+
CLIENTS=($(find specs/*/spec.yml | awk -F / '{ print $(NF-1) }'))
3939

4040
if [[ $CLIENT == "all" ]]; then
4141
CLIENTS=("${CLIENTS[@]}")

scripts/generate.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ compute_hash() {
2020
# build spec before generating client
2121
build_spec() {
2222
# check if file and cache exist
23+
mkdir -p specs/dist
2324
cacheFile="specs/dist/$CLIENT.cache"
24-
if [[ -f specs/dist/$CLIENT.yml ]]; then
25+
if [[ -f specs/bundled/$CLIENT.yml ]]; then
2526
cache=$(compute_hash)
2627
# compare with stored cache
2728
if [[ -f $cacheFile && $(cat $cacheFile) == $cache ]]; then

scripts/pre-gen/setHostsOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async function setHostsOptions(): Promise<void> {
3939
throw new Error(`Generator not found: ${generator}`);
4040
}
4141

42-
const specPath = path.join(__dirname, `../../specs/dist/${client}.yml`);
42+
const specPath = path.join(__dirname, `../../specs/bundled/${client}.yml`);
4343

4444
if (!(await stat(specPath))) {
4545
throw new Error(`File not found ${specPath}`);

specs/dist/README.md renamed to specs/bundled/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
**Please do not edit the files in this folder, they are generated and changes will be overwritten on next use**
44

5-
Output folder of the specs located in `/specs/CLIENT_NAME/spec.yml`.
5+
Output folder of the specs located in `/specs/<CLIENT_NAME>/spec.yml`.
66

77
This folder hosts the bundled specs used to:
8+
89
- Generate clients.
910
- Generate documentation.
1011
- Share single readable spec file for a specific client.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

specs/dist/query-suggestions.yml renamed to specs/bundled/query-suggestions.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ components:
4848
List of facet attributes used to generate Query Suggestions. The
4949
resulting suggestions are every combination of the facets in the nested
5050
list (e.g., (facetA and facetB) and facetC).
51-
example:
52-
- - facetA
53-
- facetB
54-
- - facetC
51+
example: '[[facetA, facetB], [facetC]]'
5552
SourceIndexExternal:
5653
type: object
5754
additionalProperties: false
File renamed without changes.
File renamed without changes.
File renamed without changes.

specs/query-suggestions/common/parameters.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ generate:
105105
type: string
106106
default: []
107107
description: List of facet attributes used to generate Query Suggestions. The resulting suggestions are every combination of the facets in the nested list (e.g., (facetA and facetB) and facetC).
108-
example: [[facetA, facetB], [facetC]]
108+
example: '[[facetA, facetB], [facetC]]'
109109

110110
external:
111111
type: array

0 commit comments

Comments
 (0)