Skip to content

Commit d5eacaa

Browse files
committed
fix(edulint): new api format
1 parent 790a4ae commit d5eacaa

19 files changed

+352
-54
lines changed

src/api/edulint.yaml

Lines changed: 86 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ info:
1515
# license:
1616
# name: Apache 2.0
1717
# url: http://www.apache.org/licenses/LICENSE-2.0.html
18-
version: 1.0.0
18+
version: 1.0.1
1919
# externalDocs:
2020
# description: Find out more about Swagger
2121
# url: http://swagger.io
2222
servers:
23-
- url: ""
23+
- url: "https://edulint.com"
24+
- url: "https://dev.edulint.com"
2425
tags:
2526
- name: API
2627
description: ""
@@ -33,6 +34,26 @@ tags:
3334
# description: Find out more about our store
3435
# url: http://swagger.io
3536
paths:
37+
/api/:
38+
get:
39+
summary: This API documentation.
40+
responses:
41+
"200":
42+
description: ""
43+
/api/versions:
44+
get:
45+
summary: List of currently supported Edulint versions.
46+
responses:
47+
"200":
48+
description: The versions are sorted -- the newest version is listed first.
49+
content:
50+
application/json:
51+
schema:
52+
type: array
53+
items:
54+
type: string
55+
example: ["2.10.2", "2.9.2"]
56+
3657
/api/code:
3758
post:
3859
tags:
@@ -41,11 +62,11 @@ paths:
4162
# description: Update an existing pet by Id
4263
# operationId: updatePet
4364
requestBody:
44-
description: the code to upload
65+
description: information on the code to upload
4566
content:
4667
application/json:
4768
schema:
48-
$ref: "#/components/schemas/Code"
69+
$ref: "#/components/schemas/CodeRequest"
4970
# application/xml:
5071
# schema:
5172
# $ref: "#/components/schemas/Pet"
@@ -63,6 +84,8 @@ paths:
6384
application/json:
6485
schema:
6586
$ref: "#/components/schemas/Hash"
87+
"400":
88+
description: Missing parameter with uploaded code
6689
# security:
6790
# - petstore_auth:
6891
# - write:pets
@@ -105,24 +128,36 @@ paths:
105128
parameters:
106129
- name: version
107130
in: path
108-
description: the version of EduLint to use
131+
description: The version of EduLint to use. You can use either a specific version (e.g. 2.0.0) or "latest".
109132
required: true
110133
schema:
111134
type: string
112-
example: 2.0.0
135+
example: latest
113136
- name: hash
114137
in: path
115138
description: the hash of the code to analyze
116139
required: true
117140
schema:
118141
$ref: "#/components/schemas/HashStr"
142+
- name: config
143+
in: query
144+
description: extra configuration to use (equivalent to command line configuration described in [EduLint's documentation](https://edulint.rtfd.io#configuration)).
145+
required: false
146+
schema:
147+
$ref: "#/components/schemas/QueryConfig"
148+
- name: use-cached-result
149+
in: query
150+
description: enables/disables using cached linting results
151+
required: false
152+
schema:
153+
$ref: "#/components/schemas/TrueBoolean"
119154
responses:
120155
"200":
121156
description: successful operation
122157
content:
123158
application/json:
124159
schema:
125-
$ref: "#/components/schemas/Problems"
160+
$ref: "#/components/schemas/AnalyzeResponse"
126161
"400":
127162
description: Invalid hash supplied
128163
"404":
@@ -136,25 +171,37 @@ paths:
136171
parameters:
137172
- name: version
138173
in: path
139-
description: the version of EduLint to use
174+
description: The version of EduLint to use. You can use either a specific version (e.g. 2.0.0) or "latest".
140175
required: true
141176
schema:
142177
type: string
143-
example: 2.0.0
178+
example: latest
179+
- name: config
180+
in: query
181+
description: extra configuration to use (equivalent to command line configuration described in [EduLint's documentation](https://edulint.rtfd.io#configuration)).
182+
required: false
183+
schema:
184+
$ref: "#/components/schemas/QueryConfig"
185+
- name: use-cached-result
186+
in: query
187+
description: enables/disables using cached linting results
188+
required: false
189+
schema:
190+
$ref: "#/components/schemas/TrueBoolean"
144191
requestBody:
145192
description: the code to upload and analyze
146193
content:
147194
application/json:
148195
schema:
149-
$ref: "#/components/schemas/Code"
196+
$ref: "#/components/schemas/CodeRequest"
150197
required: true
151198
responses:
152199
"200":
153200
description: successful operation
154201
content:
155202
application/json:
156203
schema:
157-
$ref: "#/components/schemas/Problems"
204+
$ref: "#/components/schemas/AnalyzeResponse"
158205
"400":
159206
description: Invalid hash supplied
160207
"404":
@@ -177,19 +224,23 @@ paths:
177224

178225
components:
179226
schemas:
180-
Code:
227+
CodeRequest:
181228
type: object
182229
properties:
183230
code:
184231
type: string
185232
example: print('Hello world')
233+
source_id:
234+
type: string
235+
example: ksi:task_99:user_aa554ae56217f
236+
required: [code]
186237
CodeFile:
187238
type: string
188239
format: binary
189240
example: print('Hello world')
190241
HashStr:
191242
type: string
192-
example: c4bc51f7d34f9340c33e0b3b9dcfd12aa8917fe5a11faa5f6385f5bb41be9fcf
243+
example: a10b77b1feed3225cceb4b765068965ea482abfc618eee849259f7d1401cd09d
193244
Hash:
194245
type: object
195246
properties:
@@ -200,7 +251,7 @@ components:
200251
properties:
201252
path:
202253
type: string
203-
example: codes/c4bc51f7d34f9340c33e0b3b9dcfd12aa8917fe5a11faa5f6385f5bb41be9fcf.py
254+
example: codes/a10b77b1feed3225cceb4b765068965ea482abfc618eee849259f7d1401cd09d.py
204255
source:
205256
type: string
206257
example: pylint
@@ -232,3 +283,24 @@ components:
232283
type: array
233284
items:
234285
$ref: "#/components/schemas/Problem"
286+
ConfigError:
287+
type: string
288+
example: unrecognized option foo
289+
AnalyzeResponse:
290+
type: object
291+
properties:
292+
problems:
293+
$ref: "#/components/schemas/Problems"
294+
config_errors:
295+
type: array
296+
items:
297+
$ref: "#/components/schemas/ConfigError"
298+
hash:
299+
$ref: "#/components/schemas/HashStr"
300+
QueryConfig:
301+
type: string
302+
example: config-file=cs0
303+
TrueBoolean:
304+
type: boolean
305+
enum: [true, false]
306+
default: true

src/api/edulint/api.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { HttpClient } from '@angular/common/http';
44

55

66
import { APIService } from './api/aPI.service';
7+
import { DefaultService } from './api/default.service';
78
import { WebService } from './api/web.service';
89

910
@NgModule({
@@ -12,6 +13,7 @@ import { WebService } from './api/web.service';
1213
exports: [],
1314
providers: [
1415
APIService,
16+
DefaultService,
1517
WebService ]
1618
})
1719
export class ApiModule {

src/api/edulint/api/aPI.service.ts

Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* EduLint web API
33
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
44
*
5-
* OpenAPI spec version: 1.0.0
5+
* OpenAPI spec version: 1.0.1
66
* Contact: [email protected]
77
*
88
* NOTE: This class is auto generated by the swagger code generator program.
@@ -17,11 +17,13 @@ import { CustomHttpUrlEncodingCodec } from '../encoder';
1717

1818
import { Observable } from 'rxjs';
1919

20-
import { Code } from '../model/code';
20+
import { AnalyzeResponse } from '../model/analyzeResponse';
2121
import { CodeFile } from '../model/codeFile';
22+
import { CodeRequest } from '../model/codeRequest';
2223
import { Hash } from '../model/hash';
2324
import { HashStr } from '../model/hashStr';
24-
import { Problems } from '../model/problems';
25+
import { QueryConfig } from '../model/queryConfig';
26+
import { TrueBoolean } from '../model/trueBoolean';
2527

2628
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
2729
import { Configuration } from '../configuration';
@@ -30,7 +32,7 @@ import { Configuration } from '../configurat
3032
@Injectable()
3133
export class APIService {
3234

33-
protected basePath = '';
35+
protected basePath = 'https://edulint.com';
3436
public defaultHeaders = new HttpHeaders();
3537
public configuration = new Configuration();
3638

@@ -62,15 +64,17 @@ export class APIService {
6264
/**
6365
* Analyzes the code with the given hash with the given version of EduLint
6466
*
65-
* @param version the version of EduLint to use
67+
* @param version The version of EduLint to use. You can use either a specific version (e.g. 2.0.0) or \"latest\".
6668
* @param hash the hash of the code to analyze
69+
* @param config extra configuration to use (equivalent to command line configuration described in [EduLint's documentation](https://edulint.rtfd.io#configuration)).
70+
* @param use_cached_result enables/disables using cached linting results
6771
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
6872
* @param reportProgress flag to report request and response progress.
6973
*/
70-
public analyzeUploaded(version: string, hash: HashStr, observe?: 'body', reportProgress?: boolean): Observable<Problems>;
71-
public analyzeUploaded(version: string, hash: HashStr, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Problems>>;
72-
public analyzeUploaded(version: string, hash: HashStr, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Problems>>;
73-
public analyzeUploaded(version: string, hash: HashStr, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
74+
public analyzeUploaded(version: string, hash: HashStr, config?: QueryConfig, use_cached_result?: TrueBoolean, observe?: 'body', reportProgress?: boolean): Observable<AnalyzeResponse>;
75+
public analyzeUploaded(version: string, hash: HashStr, config?: QueryConfig, use_cached_result?: TrueBoolean, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<AnalyzeResponse>>;
76+
public analyzeUploaded(version: string, hash: HashStr, config?: QueryConfig, use_cached_result?: TrueBoolean, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<AnalyzeResponse>>;
77+
public analyzeUploaded(version: string, hash: HashStr, config?: QueryConfig, use_cached_result?: TrueBoolean, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
7478

7579
if (version === null || version === undefined) {
7680
throw new Error('Required parameter version was null or undefined when calling analyzeUploaded.');
@@ -80,6 +84,16 @@ export class APIService {
8084
throw new Error('Required parameter hash was null or undefined when calling analyzeUploaded.');
8185
}
8286

87+
88+
89+
let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
90+
if (config !== undefined && config !== null) {
91+
queryParameters = queryParameters.set('config', <any>config);
92+
}
93+
if (use_cached_result !== undefined && use_cached_result !== null) {
94+
queryParameters = queryParameters.set('use-cached-result', <any>use_cached_result);
95+
}
96+
8397
let headers = this.defaultHeaders;
8498

8599
// to determine the Accept header
@@ -95,8 +109,9 @@ export class APIService {
95109
const consumes: string[] = [
96110
];
97111

98-
return this.httpClient.request<Problems>('get',`${this.basePath}/api/${encodeURIComponent(String(version))}/analyze/${encodeURIComponent(String(hash))}`,
112+
return this.httpClient.request<AnalyzeResponse>('get',`${this.basePath}/api/${encodeURIComponent(String(version))}/analyze/${encodeURIComponent(String(hash))}`,
99113
{
114+
params: queryParameters,
100115
withCredentials: this.configuration.withCredentials,
101116
headers: headers,
102117
observe: observe,
@@ -149,14 +164,14 @@ export class APIService {
149164
/**
150165
* Uploads some code
151166
*
152-
* @param body the code to upload
167+
* @param body information on the code to upload
153168
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
154169
* @param reportProgress flag to report request and response progress.
155170
*/
156-
public apiCodePost(body: Code, observe?: 'body', reportProgress?: boolean): Observable<Hash>;
157-
public apiCodePost(body: Code, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Hash>>;
158-
public apiCodePost(body: Code, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Hash>>;
159-
public apiCodePost(body: Code, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
171+
public apiCodePost(body: CodeRequest, observe?: 'body', reportProgress?: boolean): Observable<Hash>;
172+
public apiCodePost(body: CodeRequest, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Hash>>;
173+
public apiCodePost(body: CodeRequest, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Hash>>;
174+
public apiCodePost(body: CodeRequest, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
160175

161176
if (body === null || body === undefined) {
162177
throw new Error('Required parameter body was null or undefined when calling apiCodePost.');
@@ -197,14 +212,16 @@ export class APIService {
197212
* Uploads some code and returns its analysis
198213
* This endpoint combines the /code and /api/{version}/analyze/{hash} endpoints.
199214
* @param body the code to upload and analyze
200-
* @param version the version of EduLint to use
215+
* @param version The version of EduLint to use. You can use either a specific version (e.g. 2.0.0) or \&quot;latest\&quot;.
216+
* @param config extra configuration to use (equivalent to command line configuration described in [EduLint&#x27;s documentation](https://edulint.rtfd.io#configuration)).
217+
* @param use_cached_result enables/disables using cached linting results
201218
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
202219
* @param reportProgress flag to report request and response progress.
203220
*/
204-
public apiVersionAnalyzePost(body: Code, version: string, observe?: 'body', reportProgress?: boolean): Observable<Problems>;
205-
public apiVersionAnalyzePost(body: Code, version: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Problems>>;
206-
public apiVersionAnalyzePost(body: Code, version: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Problems>>;
207-
public apiVersionAnalyzePost(body: Code, version: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
221+
public apiVersionAnalyzePost(body: CodeRequest, version: string, config?: QueryConfig, use_cached_result?: TrueBoolean, observe?: 'body', reportProgress?: boolean): Observable<AnalyzeResponse>;
222+
public apiVersionAnalyzePost(body: CodeRequest, version: string, config?: QueryConfig, use_cached_result?: TrueBoolean, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<AnalyzeResponse>>;
223+
public apiVersionAnalyzePost(body: CodeRequest, version: string, config?: QueryConfig, use_cached_result?: TrueBoolean, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<AnalyzeResponse>>;
224+
public apiVersionAnalyzePost(body: CodeRequest, version: string, config?: QueryConfig, use_cached_result?: TrueBoolean, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
208225

209226
if (body === null || body === undefined) {
210227
throw new Error('Required parameter body was null or undefined when calling apiVersionAnalyzePost.');
@@ -214,6 +231,16 @@ export class APIService {
214231
throw new Error('Required parameter version was null or undefined when calling apiVersionAnalyzePost.');
215232
}
216233

234+
235+
236+
let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
237+
if (config !== undefined && config !== null) {
238+
queryParameters = queryParameters.set('config', <any>config);
239+
}
240+
if (use_cached_result !== undefined && use_cached_result !== null) {
241+
queryParameters = queryParameters.set('use-cached-result', <any>use_cached_result);
242+
}
243+
217244
let headers = this.defaultHeaders;
218245

219246
// to determine the Accept header
@@ -234,9 +261,10 @@ export class APIService {
234261
headers = headers.set('Content-Type', httpContentTypeSelected);
235262
}
236263

237-
return this.httpClient.request<Problems>('post',`${this.basePath}/api/${encodeURIComponent(String(version))}/analyze`,
264+
return this.httpClient.request<AnalyzeResponse>('post',`${this.basePath}/api/${encodeURIComponent(String(version))}/analyze`,
238265
{
239266
body: body,
267+
params: queryParameters,
240268
withCredentials: this.configuration.withCredentials,
241269
headers: headers,
242270
observe: observe,

src/api/edulint/api/api.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
export * from './aPI.service';
22
import { APIService } from './aPI.service';
3+
export * from './default.service';
4+
import { DefaultService } from './default.service';
35
export * from './web.service';
46
import { WebService } from './web.service';
5-
export const APIS = [APIService, WebService];
7+
export const APIS = [APIService, DefaultService, WebService];

0 commit comments

Comments
 (0)