Skip to content

Commit 622bce1

Browse files
authored
feat(specs): bundle specs (#91)
1 parent eeabfe0 commit 622bce1

File tree

72 files changed

+675
-344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+675
-344
lines changed

.github/actions/cache/action.yml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,67 +5,82 @@ description: Restore cached dependencies.
55
inputs:
66
job:
77
description: The job that requires this composite
8-
required: true
8+
required: false
9+
language:
10+
description: The language to retrieve dependencies
11+
required: false
12+
default: javascript
13+
spec:
14+
description: The spec name to restore
15+
required: false
916

1017
runs:
1118
using: composite
1219
steps:
20+
# restore specs
21+
- name: Restore built ${{ inputs.spec }} spec
22+
if: ${{ inputs.job == 'client' }}
23+
uses: actions/cache@v2
24+
with:
25+
path: /home/runner/work/api-clients-automation/api-clients-automation/specs/dist/${{ inputs.spec }}.yml
26+
key: ${{ runner.os }}-${{ inputs.spec }}-specs-${{ hashFiles(format('specs/{0}/**', inputs.spec)) }}
27+
1328
# restore clients
1429
- name: Restore built JavaScript search client
1530
if: ${{ inputs.job == 'cts' }}
1631
uses: actions/cache@v2
1732
with:
1833
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-search/dist
19-
key: ${{ runner.os }}-js-client-search-${{ hashFiles('clients/algoliasearch-client-javascript/client-search/**') }}
34+
key: ${{ runner.os }}-1-js-client-search-${{ hashFiles('clients/algoliasearch-client-javascript/client-search/**') }}
2035

2136
- name: Restore built JavaScript recommend client
2237
if: ${{ inputs.job == 'cts' }}
2338
uses: actions/cache@v2
2439
with:
2540
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/recommend/dist
26-
key: ${{ runner.os }}-js-client-recommend-${{ hashFiles('clients/algoliasearch-client-javascript/recommend/**') }}
41+
key: ${{ runner.os }}-1-js-client-recommend-${{ hashFiles('clients/algoliasearch-client-javascript/recommend/**') }}
2742

2843
- name: Restore built JavaScript query-suggestions client
2944
if: ${{ inputs.job == 'cts' }}
3045
uses: actions/cache@v2
3146
with:
3247
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-query-suggestions/dist
33-
key: ${{ runner.os }}-js-client-query-suggestions-${{ hashFiles('clients/algoliasearch-client-javascript/client-query-suggestions/**') }}
48+
key: ${{ runner.os }}-1-js-client-query-suggestions-${{ hashFiles('clients/algoliasearch-client-javascript/client-query-suggestions/**') }}
3449

3550
- name: Restore built JavaScript personalization client
3651
if: ${{ inputs.job == 'cts' }}
3752
uses: actions/cache@v2
3853
with:
3954
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-personalization/dist
40-
key: ${{ runner.os }}-js-client-personalization-${{ hashFiles('clients/algoliasearch-client-javascript/client-personalization/**') }}
55+
key: ${{ runner.os }}-1-js-client-personalization-${{ hashFiles('clients/algoliasearch-client-javascript/client-personalization/**') }}
4156

4257
- name: Restore built JavaScript analytics client
4358
if: ${{ inputs.job == 'cts' }}
4459
uses: actions/cache@v2
4560
with:
4661
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-analytics/dist
47-
key: ${{ runner.os }}-js-client-analytics-${{ hashFiles('clients/algoliasearch-client-javascript/client-analytics/**') }}
62+
key: ${{ runner.os }}-1-js-client-analytics-${{ hashFiles('clients/algoliasearch-client-javascript/client-analytics/**') }}
4863

4964
- name: Restore built JavaScript abtesting client
5065
if: ${{ inputs.job == 'cts' }}
5166
uses: actions/cache@v2
5267
with:
5368
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-abtesting/dist
54-
key: ${{ runner.os }}-js-client-abtesting-${{ hashFiles('clients/algoliasearch-client-javascript/client-abtesting/**') }}
69+
key: ${{ runner.os }}-1-js-client-abtesting-${{ hashFiles('clients/algoliasearch-client-javascript/client-abtesting/**') }}
5570

5671
- name: Restore built JavaScript insights client
5772
if: ${{ inputs.job == 'cts' }}
5873
uses: actions/cache@v2
5974
with:
6075
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-insights/dist
61-
key: ${{ runner.os }}-js-client-insights-${{ hashFiles('clients/algoliasearch-client-javascript/client-insights/**') }}
76+
key: ${{ runner.os }}-1-js-client-insights-${{ hashFiles('clients/algoliasearch-client-javascript/client-insights/**') }}
6277

6378
- name: Restore built Java client
6479
if: ${{ inputs.job == 'cts' }}
6580
uses: actions/cache@v2
6681
with:
6782
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-java-2/target
68-
key: ${{ runner.os }}-java-client-${{ hashFiles('clients/algoliasearch-client-java-2/**') }}
83+
key: ${{ runner.os }}-1-java-client-${{ hashFiles('clients/algoliasearch-client-java-2/**') }}
6984

7085
# setup yarn
7186
- name: Get yarn cache directory path
@@ -85,13 +100,13 @@ runs:
85100

86101
# setup maven
87102
- name: Restore Maven
88-
if: ${{ inputs.job == 'java' }}
103+
if: ${{ inputs.language == 'java' }}
89104
uses: actions/cache@v2
90105
with:
91106
path: ~/.m2/repository
92107
key: setup-java-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
93108

94109
- name: Install Maven dependencies
95-
if: ${{ inputs.job == 'java' }}
110+
if: ${{ inputs.language == 'java' }}
96111
shell: bash
97112
run: mvn clean install -f clients/algoliasearch-client-java-2/pom.xml

.github/workflows/check.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,16 @@ jobs:
5050
- name: Restore cache
5151
uses: ./.github/actions/cache
5252

53-
- name: Checking ${{ matrix.client }} specs
54-
run: yarn build:specs ${{ matrix.client }}
53+
- name: Cache ${{ matrix.client }} spec
54+
id: cache
55+
uses: actions/cache@v2
56+
with:
57+
path: '/home/runner/work/api-clients-automation/api-clients-automation/specs/dist/${{ matrix.client }}.yml'
58+
key: ${{ runner.os }}-${{ matrix.client }}-specs-${{ hashFiles(format('specs/{0}/**', matrix.client)) }}
5559

56-
- name: Lint ${{ matrix.client }} specs
57-
run: yarn eslint --ext=yml specs/${{ matrix.client }}
60+
- name: Building ${{ matrix.client }} specs
61+
if: steps.cache.outputs.cache-hit != 'true'
62+
run: yarn build:specs ${{ matrix.client }}
5863

5964
client_javascript:
6065
runs-on: ubuntu-20.04
@@ -69,13 +74,16 @@ jobs:
6974

7075
- name: Restore cache
7176
uses: ./.github/actions/cache
77+
with:
78+
job: client
79+
spec: ${{ matrix.client.name }}
7280

7381
- name: Cache ${{ matrix.client.name }} client
7482
id: cache
7583
uses: actions/cache@v2
7684
with:
7785
path: '/home/runner/work/api-clients-automation/api-clients-automation/${{ matrix.client.folder }}/dist'
78-
key: ${{ runner.os }}-js-client-${{ matrix.client.name }}-${{ hashFiles(format('{0}/**', matrix.client.folder)) }}
86+
key: ${{ runner.os }}-1-js-client-${{ matrix.client.name }}-${{ hashFiles(format('{0}/**', matrix.client.folder)) }}
7987

8088
- name: Generate ${{ matrix.client.name }} client
8189
if: steps.cache.outputs.cache-hit != 'true'
@@ -99,14 +107,16 @@ jobs:
99107
- name: Restore cache
100108
uses: ./.github/actions/cache
101109
with:
102-
job: java
110+
job: client
111+
language: java
112+
spec: ${{ matrix.client.name }}
103113

104114
- name: Cache ${{ matrix.client.name }} client
105115
id: cache
106116
uses: actions/cache@v2
107117
with:
108-
path: '/home/runner/work/api-clients-automation/api-clients-automation/${{ matrix.client.folder }}/dist'
109-
key: ${{ runner.os }}-java-client-${{ matrix.client.name }}-${{ hashFiles(format('{0}/**', matrix.client.folder)) }}
118+
path: '/home/runner/work/api-clients-automation/api-clients-automation/${{ matrix.client.folder }}/target'
119+
key: ${{ runner.os }}-1-java-client-${{ matrix.client.name }}-${{ hashFiles(format('{0}/**', matrix.client.folder)) }}
110120

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

.redocly.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiDefinitions:
2+
abtesting: specs/abtesting/spec.yml
3+
analytics: specs/analytics/spec.yml
4+
insights: specs/insights/spec.yml
5+
personalization: specs/personalization/spec.yml
6+
query-suggestions: specs/query-suggestions/spec.yml
7+
recommend: specs/recommend/spec.yml
8+
search: specs/search/spec.yml
9+
10+
lint:
11+
extends:
12+
- recommended
13+
14+
rules:
15+
no-empty-servers: off
16+
info-license: off # for now we can keep it off.
17+
no-ambiguous-paths: off # this is out of our scope.
18+
no-enum-type-mismatch: warn # keeping the warning since it only occur on one edge case
19+
20+
tag-description: error
21+
parameter-description: error
22+
operation-description: error
23+
operation-parameters-unique: error
24+
tags-alphabetical: error

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BuildInOperation.java renamed to clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BuiltInOperation.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* To update an attribute without pushing the entire record, you can use these built-in operations.
1313
*/
14-
public class BuildInOperation {
14+
public class BuiltInOperation {
1515

1616
/** The operation to apply on the attribute. */
1717
@JsonAdapter(OperationEnum.Adapter.class)
@@ -79,7 +79,7 @@ public OperationEnum read(final JsonReader jsonReader)
7979
@SerializedName("value")
8080
private String value;
8181

82-
public BuildInOperation operation(OperationEnum operation) {
82+
public BuiltInOperation operation(OperationEnum operation) {
8383
this.operation = operation;
8484
return this;
8585
}
@@ -98,7 +98,7 @@ public void setOperation(OperationEnum operation) {
9898
this.operation = operation;
9999
}
100100

101-
public BuildInOperation value(String value) {
101+
public BuiltInOperation value(String value) {
102102
this.value = value;
103103
return this;
104104
}
@@ -126,10 +126,10 @@ public boolean equals(Object o) {
126126
if (o == null || getClass() != o.getClass()) {
127127
return false;
128128
}
129-
BuildInOperation buildInOperation = (BuildInOperation) o;
129+
BuiltInOperation builtInOperation = (BuiltInOperation) o;
130130
return (
131-
Objects.equals(this.operation, buildInOperation.operation) &&
132-
Objects.equals(this.value, buildInOperation.value)
131+
Objects.equals(this.operation, builtInOperation.operation) &&
132+
Objects.equals(this.value, builtInOperation.value)
133133
);
134134
}
135135

@@ -141,7 +141,7 @@ public int hashCode() {
141141
@Override
142142
public String toString() {
143143
StringBuilder sb = new StringBuilder();
144-
sb.append("class BuildInOperation {\n");
144+
sb.append("class BuiltInOperation {\n");
145145
sb
146146
.append(" operation: ")
147147
.append(toIndentedString(operation))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.algolia.model;
2+
3+
public class OneOfstringbuiltInOperation {}

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchUserIdsResponseHits.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
public class SearchUserIdsResponseHits {
88

99
@SerializedName("userID")
10-
private UserId userID;
10+
private String userID;
1111

1212
@SerializedName("clusterName")
1313
private String clusterName;
@@ -24,22 +24,22 @@ public class SearchUserIdsResponseHits {
2424
@SerializedName("_highlightResult")
2525
private SearchUserIdsResponseHighlightResult highlightResult;
2626

27-
public SearchUserIdsResponseHits userID(UserId userID) {
27+
public SearchUserIdsResponseHits userID(String userID) {
2828
this.userID = userID;
2929
return this;
3030
}
3131

3232
/**
33-
* Get userID
33+
* userID of the user.
3434
*
3535
* @return userID
3636
*/
3737
@javax.annotation.Nonnull
38-
public UserId getUserID() {
38+
public String getUserID() {
3939
return userID;
4040
}
4141

42-
public void setUserID(UserId userID) {
42+
public void setUserID(String userID) {
4343
this.userID = userID;
4444
}
4545

0 commit comments

Comments
 (0)