From 203f394a3db0ef02aacac781261bfec9a17075e0 Mon Sep 17 00:00:00 2001 From: Adam Hlavacek Date: Sun, 30 Jun 2024 11:25:54 +0200 Subject: [PATCH] fix(edulint): new api format --- src/api/edulint.yaml | 100 ++++++++++++-- src/api/edulint/api.module.ts | 2 + src/api/edulint/api/aPI.service.ts | 70 +++++++--- src/api/edulint/api/api.ts | 4 +- src/api/edulint/api/default.service.ts | 128 ++++++++++++++++++ src/api/edulint/api/web.service.ts | 4 +- src/api/edulint/model/analyzeResponse.ts | 20 +++ src/api/edulint/model/codeFile.ts | 2 +- src/api/edulint/model/codeRequest.ts | 16 +++ .../edulint/model/{code.ts => configError.ts} | 6 +- src/api/edulint/model/hash.ts | 2 +- src/api/edulint/model/hashStr.ts | 2 +- src/api/edulint/model/models.ts | 6 +- src/api/edulint/model/problem.ts | 2 +- src/api/edulint/model/problems.ts | 2 +- src/api/edulint/model/queryConfig.ts | 13 ++ src/api/edulint/model/trueBoolean.ts | 18 +++ src/app/services/tasks/edulint.service.ts | 4 +- util/gen-api.sh | 5 +- 19 files changed, 352 insertions(+), 54 deletions(-) create mode 100644 src/api/edulint/api/default.service.ts create mode 100644 src/api/edulint/model/analyzeResponse.ts create mode 100644 src/api/edulint/model/codeRequest.ts rename src/api/edulint/model/{code.ts => configError.ts} (81%) create mode 100644 src/api/edulint/model/queryConfig.ts create mode 100644 src/api/edulint/model/trueBoolean.ts diff --git a/src/api/edulint.yaml b/src/api/edulint.yaml index aeafda4..2816a52 100644 --- a/src/api/edulint.yaml +++ b/src/api/edulint.yaml @@ -15,12 +15,13 @@ info: # license: # name: Apache 2.0 # url: http://www.apache.org/licenses/LICENSE-2.0.html - version: 1.0.0 + version: 1.0.1 # externalDocs: # description: Find out more about Swagger # url: http://swagger.io servers: - - url: "" + - url: "https://edulint.com" + - url: "https://dev.edulint.com" tags: - name: API description: "" @@ -33,6 +34,26 @@ tags: # description: Find out more about our store # url: http://swagger.io paths: + /api/: + get: + summary: This API documentation. + responses: + "200": + description: "" + /api/versions: + get: + summary: List of currently supported Edulint versions. + responses: + "200": + description: The versions are sorted -- the newest version is listed first. + content: + application/json: + schema: + type: array + items: + type: string + example: ["2.10.2", "2.9.2"] + /api/code: post: tags: @@ -41,11 +62,11 @@ paths: # description: Update an existing pet by Id # operationId: updatePet requestBody: - description: the code to upload + description: information on the code to upload content: application/json: schema: - $ref: "#/components/schemas/Code" + $ref: "#/components/schemas/CodeRequest" # application/xml: # schema: # $ref: "#/components/schemas/Pet" @@ -63,6 +84,8 @@ paths: application/json: schema: $ref: "#/components/schemas/Hash" + "400": + description: Missing parameter with uploaded code # security: # - petstore_auth: # - write:pets @@ -105,24 +128,36 @@ paths: parameters: - name: version in: path - description: the version of EduLint to use + description: The version of EduLint to use. You can use either a specific version (e.g. 2.0.0) or "latest". required: true schema: type: string - example: 2.0.0 + example: latest - name: hash in: path description: the hash of the code to analyze required: true schema: $ref: "#/components/schemas/HashStr" + - name: config + in: query + description: extra configuration to use (equivalent to command line configuration described in [EduLint's documentation](https://edulint.rtfd.io#configuration)). + required: false + schema: + $ref: "#/components/schemas/QueryConfig" + - name: use-cached-result + in: query + description: enables/disables using cached linting results + required: false + schema: + $ref: "#/components/schemas/TrueBoolean" responses: "200": description: successful operation content: application/json: schema: - $ref: "#/components/schemas/Problems" + $ref: "#/components/schemas/AnalyzeResponse" "400": description: Invalid hash supplied "404": @@ -136,17 +171,29 @@ paths: parameters: - name: version in: path - description: the version of EduLint to use + description: The version of EduLint to use. You can use either a specific version (e.g. 2.0.0) or "latest". required: true schema: type: string - example: 2.0.0 + example: latest + - name: config + in: query + description: extra configuration to use (equivalent to command line configuration described in [EduLint's documentation](https://edulint.rtfd.io#configuration)). + required: false + schema: + $ref: "#/components/schemas/QueryConfig" + - name: use-cached-result + in: query + description: enables/disables using cached linting results + required: false + schema: + $ref: "#/components/schemas/TrueBoolean" requestBody: description: the code to upload and analyze content: application/json: schema: - $ref: "#/components/schemas/Code" + $ref: "#/components/schemas/CodeRequest" required: true responses: "200": @@ -154,7 +201,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Problems" + $ref: "#/components/schemas/AnalyzeResponse" "400": description: Invalid hash supplied "404": @@ -177,19 +224,23 @@ paths: components: schemas: - Code: + CodeRequest: type: object properties: code: type: string example: print('Hello world') + source_id: + type: string + example: ksi:task_99:user_aa554ae56217f + required: [code] CodeFile: type: string format: binary example: print('Hello world') HashStr: type: string - example: c4bc51f7d34f9340c33e0b3b9dcfd12aa8917fe5a11faa5f6385f5bb41be9fcf + example: a10b77b1feed3225cceb4b765068965ea482abfc618eee849259f7d1401cd09d Hash: type: object properties: @@ -200,7 +251,7 @@ components: properties: path: type: string - example: codes/c4bc51f7d34f9340c33e0b3b9dcfd12aa8917fe5a11faa5f6385f5bb41be9fcf.py + example: codes/a10b77b1feed3225cceb4b765068965ea482abfc618eee849259f7d1401cd09d.py source: type: string example: pylint @@ -232,3 +283,24 @@ components: type: array items: $ref: "#/components/schemas/Problem" + ConfigError: + type: string + example: unrecognized option foo + AnalyzeResponse: + type: object + properties: + problems: + $ref: "#/components/schemas/Problems" + config_errors: + type: array + items: + $ref: "#/components/schemas/ConfigError" + hash: + $ref: "#/components/schemas/HashStr" + QueryConfig: + type: string + example: config-file=cs0 + TrueBoolean: + type: boolean + enum: [true, false] + default: true diff --git a/src/api/edulint/api.module.ts b/src/api/edulint/api.module.ts index cdcf44a..e3343ad 100644 --- a/src/api/edulint/api.module.ts +++ b/src/api/edulint/api.module.ts @@ -4,6 +4,7 @@ import { HttpClient } from '@angular/common/http'; import { APIService } from './api/aPI.service'; +import { DefaultService } from './api/default.service'; import { WebService } from './api/web.service'; @NgModule({ @@ -12,6 +13,7 @@ import { WebService } from './api/web.service'; exports: [], providers: [ APIService, + DefaultService, WebService ] }) export class ApiModule { diff --git a/src/api/edulint/api/aPI.service.ts b/src/api/edulint/api/aPI.service.ts index a3b43aa..c0a4fa0 100644 --- a/src/api/edulint/api/aPI.service.ts +++ b/src/api/edulint/api/aPI.service.ts @@ -2,7 +2,7 @@ * EduLint web API * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: 1.0.0 + * OpenAPI spec version: 1.0.1 * Contact: contact@edulint.com * * NOTE: This class is auto generated by the swagger code generator program. @@ -17,11 +17,13 @@ import { CustomHttpUrlEncodingCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Code } from '../model/code'; +import { AnalyzeResponse } from '../model/analyzeResponse'; import { CodeFile } from '../model/codeFile'; +import { CodeRequest } from '../model/codeRequest'; import { Hash } from '../model/hash'; import { HashStr } from '../model/hashStr'; -import { Problems } from '../model/problems'; +import { QueryConfig } from '../model/queryConfig'; +import { TrueBoolean } from '../model/trueBoolean'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; @@ -30,7 +32,7 @@ import { Configuration } from '../configurat @Injectable() export class APIService { - protected basePath = ''; + protected basePath = 'https://edulint.com'; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); @@ -62,15 +64,17 @@ export class APIService { /** * Analyzes the code with the given hash with the given version of EduLint * - * @param version the version of EduLint to use + * @param version The version of EduLint to use. You can use either a specific version (e.g. 2.0.0) or \"latest\". * @param hash the hash of the code to analyze + * @param config extra configuration to use (equivalent to command line configuration described in [EduLint's documentation](https://edulint.rtfd.io#configuration)). + * @param use_cached_result enables/disables using cached linting results * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public analyzeUploaded(version: string, hash: HashStr, observe?: 'body', reportProgress?: boolean): Observable; - public analyzeUploaded(version: string, hash: HashStr, observe?: 'response', reportProgress?: boolean): Observable>; - public analyzeUploaded(version: string, hash: HashStr, observe?: 'events', reportProgress?: boolean): Observable>; - public analyzeUploaded(version: string, hash: HashStr, observe: any = 'body', reportProgress: boolean = false ): Observable { + public analyzeUploaded(version: string, hash: HashStr, config?: QueryConfig, use_cached_result?: TrueBoolean, observe?: 'body', reportProgress?: boolean): Observable; + public analyzeUploaded(version: string, hash: HashStr, config?: QueryConfig, use_cached_result?: TrueBoolean, observe?: 'response', reportProgress?: boolean): Observable>; + public analyzeUploaded(version: string, hash: HashStr, config?: QueryConfig, use_cached_result?: TrueBoolean, observe?: 'events', reportProgress?: boolean): Observable>; + public analyzeUploaded(version: string, hash: HashStr, config?: QueryConfig, use_cached_result?: TrueBoolean, observe: any = 'body', reportProgress: boolean = false ): Observable { if (version === null || version === undefined) { throw new Error('Required parameter version was null or undefined when calling analyzeUploaded.'); @@ -80,6 +84,16 @@ export class APIService { throw new Error('Required parameter hash was null or undefined when calling analyzeUploaded.'); } + + + let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); + if (config !== undefined && config !== null) { + queryParameters = queryParameters.set('config', config); + } + if (use_cached_result !== undefined && use_cached_result !== null) { + queryParameters = queryParameters.set('use-cached-result', use_cached_result); + } + let headers = this.defaultHeaders; // to determine the Accept header @@ -95,8 +109,9 @@ export class APIService { const consumes: string[] = [ ]; - return this.httpClient.request('get',`${this.basePath}/api/${encodeURIComponent(String(version))}/analyze/${encodeURIComponent(String(hash))}`, + return this.httpClient.request('get',`${this.basePath}/api/${encodeURIComponent(String(version))}/analyze/${encodeURIComponent(String(hash))}`, { + params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -149,14 +164,14 @@ export class APIService { /** * Uploads some code * - * @param body the code to upload + * @param body information on the code to upload * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public apiCodePost(body: Code, observe?: 'body', reportProgress?: boolean): Observable; - public apiCodePost(body: Code, observe?: 'response', reportProgress?: boolean): Observable>; - public apiCodePost(body: Code, observe?: 'events', reportProgress?: boolean): Observable>; - public apiCodePost(body: Code, observe: any = 'body', reportProgress: boolean = false ): Observable { + public apiCodePost(body: CodeRequest, observe?: 'body', reportProgress?: boolean): Observable; + public apiCodePost(body: CodeRequest, observe?: 'response', reportProgress?: boolean): Observable>; + public apiCodePost(body: CodeRequest, observe?: 'events', reportProgress?: boolean): Observable>; + public apiCodePost(body: CodeRequest, observe: any = 'body', reportProgress: boolean = false ): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling apiCodePost.'); @@ -197,14 +212,16 @@ export class APIService { * Uploads some code and returns its analysis * This endpoint combines the /code and /api/{version}/analyze/{hash} endpoints. * @param body the code to upload and analyze - * @param version the version of EduLint to use + * @param version The version of EduLint to use. You can use either a specific version (e.g. 2.0.0) or \"latest\". + * @param config extra configuration to use (equivalent to command line configuration described in [EduLint's documentation](https://edulint.rtfd.io#configuration)). + * @param use_cached_result enables/disables using cached linting results * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public apiVersionAnalyzePost(body: Code, version: string, observe?: 'body', reportProgress?: boolean): Observable; - public apiVersionAnalyzePost(body: Code, version: string, observe?: 'response', reportProgress?: boolean): Observable>; - public apiVersionAnalyzePost(body: Code, version: string, observe?: 'events', reportProgress?: boolean): Observable>; - public apiVersionAnalyzePost(body: Code, version: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + public apiVersionAnalyzePost(body: CodeRequest, version: string, config?: QueryConfig, use_cached_result?: TrueBoolean, observe?: 'body', reportProgress?: boolean): Observable; + public apiVersionAnalyzePost(body: CodeRequest, version: string, config?: QueryConfig, use_cached_result?: TrueBoolean, observe?: 'response', reportProgress?: boolean): Observable>; + public apiVersionAnalyzePost(body: CodeRequest, version: string, config?: QueryConfig, use_cached_result?: TrueBoolean, observe?: 'events', reportProgress?: boolean): Observable>; + public apiVersionAnalyzePost(body: CodeRequest, version: string, config?: QueryConfig, use_cached_result?: TrueBoolean, observe: any = 'body', reportProgress: boolean = false ): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling apiVersionAnalyzePost.'); @@ -214,6 +231,16 @@ export class APIService { throw new Error('Required parameter version was null or undefined when calling apiVersionAnalyzePost.'); } + + + let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); + if (config !== undefined && config !== null) { + queryParameters = queryParameters.set('config', config); + } + if (use_cached_result !== undefined && use_cached_result !== null) { + queryParameters = queryParameters.set('use-cached-result', use_cached_result); + } + let headers = this.defaultHeaders; // to determine the Accept header @@ -234,9 +261,10 @@ export class APIService { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request('post',`${this.basePath}/api/${encodeURIComponent(String(version))}/analyze`, + return this.httpClient.request('post',`${this.basePath}/api/${encodeURIComponent(String(version))}/analyze`, { body: body, + params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, diff --git a/src/api/edulint/api/api.ts b/src/api/edulint/api/api.ts index cf9eaf2..14bc611 100644 --- a/src/api/edulint/api/api.ts +++ b/src/api/edulint/api/api.ts @@ -1,5 +1,7 @@ export * from './aPI.service'; import { APIService } from './aPI.service'; +export * from './default.service'; +import { DefaultService } from './default.service'; export * from './web.service'; import { WebService } from './web.service'; -export const APIS = [APIService, WebService]; +export const APIS = [APIService, DefaultService, WebService]; diff --git a/src/api/edulint/api/default.service.ts b/src/api/edulint/api/default.service.ts new file mode 100644 index 0000000..fc99624 --- /dev/null +++ b/src/api/edulint/api/default.service.ts @@ -0,0 +1,128 @@ +/** + * EduLint web API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.1 + * Contact: contact@edulint.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + *//* tslint:disable:no-unused-variable member-ordering */ + +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent } from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; + +import { Observable } from 'rxjs'; + + +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; + + +@Injectable() +export class DefaultService { + + protected basePath = 'https://edulint.com'; + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); + + constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } + } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + for (const consume of consumes) { + if (form === consume) { + return true; + } + } + return false; + } + + + /** + * This API documentation. + * + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public apiGet(observe?: 'body', reportProgress?: boolean): Observable; + public apiGet(observe?: 'response', reportProgress?: boolean): Observable>; + public apiGet(observe?: 'events', reportProgress?: boolean): Observable>; + public apiGet(observe: any = 'body', reportProgress: boolean = false ): Observable { + + let headers = this.defaultHeaders; + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + + return this.httpClient.request('get',`${this.basePath}/api/`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); + } + + /** + * List of currently supported Edulint versions. + * + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public apiVersionsGet(observe?: 'body', reportProgress?: boolean): Observable>; + public apiVersionsGet(observe?: 'response', reportProgress?: boolean): Observable>>; + public apiVersionsGet(observe?: 'events', reportProgress?: boolean): Observable>>; + public apiVersionsGet(observe: any = 'body', reportProgress: boolean = false ): Observable { + + let headers = this.defaultHeaders; + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + + return this.httpClient.request>('get',`${this.basePath}/api/versions`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); + } + +} diff --git a/src/api/edulint/api/web.service.ts b/src/api/edulint/api/web.service.ts index 50376b1..173e693 100644 --- a/src/api/edulint/api/web.service.ts +++ b/src/api/edulint/api/web.service.ts @@ -2,7 +2,7 @@ * EduLint web API * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: 1.0.0 + * OpenAPI spec version: 1.0.1 * Contact: contact@edulint.com * * NOTE: This class is auto generated by the swagger code generator program. @@ -26,7 +26,7 @@ import { Configuration } from '../configurat @Injectable() export class WebService { - protected basePath = ''; + protected basePath = 'https://edulint.com'; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); diff --git a/src/api/edulint/model/analyzeResponse.ts b/src/api/edulint/model/analyzeResponse.ts new file mode 100644 index 0000000..e3bfa71 --- /dev/null +++ b/src/api/edulint/model/analyzeResponse.ts @@ -0,0 +1,20 @@ +/** + * EduLint web API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.1 + * Contact: contact@edulint.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +import { ConfigError } from './configError'; +import { HashStr } from './hashStr'; +import { Problems } from './problems'; + +export interface AnalyzeResponse { + problems?: Problems; + config_errors?: Array; + hash?: HashStr; +} \ No newline at end of file diff --git a/src/api/edulint/model/codeFile.ts b/src/api/edulint/model/codeFile.ts index f77abf3..5b4def6 100644 --- a/src/api/edulint/model/codeFile.ts +++ b/src/api/edulint/model/codeFile.ts @@ -2,7 +2,7 @@ * EduLint web API * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: 1.0.0 + * OpenAPI spec version: 1.0.1 * Contact: contact@edulint.com * * NOTE: This class is auto generated by the swagger code generator program. diff --git a/src/api/edulint/model/codeRequest.ts b/src/api/edulint/model/codeRequest.ts new file mode 100644 index 0000000..41787ea --- /dev/null +++ b/src/api/edulint/model/codeRequest.ts @@ -0,0 +1,16 @@ +/** + * EduLint web API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.1 + * Contact: contact@edulint.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +export interface CodeRequest { + code: string; + source_id?: string; +} \ No newline at end of file diff --git a/src/api/edulint/model/code.ts b/src/api/edulint/model/configError.ts similarity index 81% rename from src/api/edulint/model/code.ts rename to src/api/edulint/model/configError.ts index b1099a2..40f1481 100644 --- a/src/api/edulint/model/code.ts +++ b/src/api/edulint/model/configError.ts @@ -2,7 +2,7 @@ * EduLint web API * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: 1.0.0 + * OpenAPI spec version: 1.0.1 * Contact: contact@edulint.com * * NOTE: This class is auto generated by the swagger code generator program. @@ -10,6 +10,4 @@ * Do not edit the class manually. */ -export interface Code { - code?: string; -} \ No newline at end of file +export type ConfigError = string; \ No newline at end of file diff --git a/src/api/edulint/model/hash.ts b/src/api/edulint/model/hash.ts index 75819e1..1c5df2f 100644 --- a/src/api/edulint/model/hash.ts +++ b/src/api/edulint/model/hash.ts @@ -2,7 +2,7 @@ * EduLint web API * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: 1.0.0 + * OpenAPI spec version: 1.0.1 * Contact: contact@edulint.com * * NOTE: This class is auto generated by the swagger code generator program. diff --git a/src/api/edulint/model/hashStr.ts b/src/api/edulint/model/hashStr.ts index e505dfb..aa8c8e4 100644 --- a/src/api/edulint/model/hashStr.ts +++ b/src/api/edulint/model/hashStr.ts @@ -2,7 +2,7 @@ * EduLint web API * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: 1.0.0 + * OpenAPI spec version: 1.0.1 * Contact: contact@edulint.com * * NOTE: This class is auto generated by the swagger code generator program. diff --git a/src/api/edulint/model/models.ts b/src/api/edulint/model/models.ts index f8a2069..a7e941f 100644 --- a/src/api/edulint/model/models.ts +++ b/src/api/edulint/model/models.ts @@ -1,6 +1,10 @@ -export * from './code'; +export * from './analyzeResponse'; export * from './codeFile'; +export * from './codeRequest'; +export * from './configError'; export * from './hash'; export * from './hashStr'; export * from './problem'; export * from './problems'; +export * from './queryConfig'; +export * from './trueBoolean'; diff --git a/src/api/edulint/model/problem.ts b/src/api/edulint/model/problem.ts index 5d5bb67..cd87cd7 100644 --- a/src/api/edulint/model/problem.ts +++ b/src/api/edulint/model/problem.ts @@ -2,7 +2,7 @@ * EduLint web API * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: 1.0.0 + * OpenAPI spec version: 1.0.1 * Contact: contact@edulint.com * * NOTE: This class is auto generated by the swagger code generator program. diff --git a/src/api/edulint/model/problems.ts b/src/api/edulint/model/problems.ts index db91c22..3813521 100644 --- a/src/api/edulint/model/problems.ts +++ b/src/api/edulint/model/problems.ts @@ -2,7 +2,7 @@ * EduLint web API * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * - * OpenAPI spec version: 1.0.0 + * OpenAPI spec version: 1.0.1 * Contact: contact@edulint.com * * NOTE: This class is auto generated by the swagger code generator program. diff --git a/src/api/edulint/model/queryConfig.ts b/src/api/edulint/model/queryConfig.ts new file mode 100644 index 0000000..1dae37f --- /dev/null +++ b/src/api/edulint/model/queryConfig.ts @@ -0,0 +1,13 @@ +/** + * EduLint web API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.1 + * Contact: contact@edulint.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +export type QueryConfig = string; \ No newline at end of file diff --git a/src/api/edulint/model/trueBoolean.ts b/src/api/edulint/model/trueBoolean.ts new file mode 100644 index 0000000..692b71e --- /dev/null +++ b/src/api/edulint/model/trueBoolean.ts @@ -0,0 +1,18 @@ +/** + * EduLint web API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.1 + * Contact: contact@edulint.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +export type TrueBoolean = 'true' | 'false'; + +export const TrueBoolean = { + True: 'true' as TrueBoolean, + False: 'false' as TrueBoolean +}; \ No newline at end of file diff --git a/src/app/services/tasks/edulint.service.ts b/src/app/services/tasks/edulint.service.ts index f7936a4..0314432 100644 --- a/src/app/services/tasks/edulint.service.ts +++ b/src/app/services/tasks/edulint.service.ts @@ -42,8 +42,8 @@ export class EdulintService { mergeMap((hash) => combineLatest([this.linter.analyzeUploaded(this.version, hash), of(hash)])), take(1), shareReplay(1), - map(([problems, hash]) => ({ - problems, + map(([analyzed, hash]) => ({ + problems: analyzed.problems || [], editorUrl: `${this.url}/editor/${hash}` })) ); diff --git a/util/gen-api.sh b/util/gen-api.sh index 734ec69..cef7077 100755 --- a/util/gen-api.sh +++ b/util/gen-api.sh @@ -53,9 +53,6 @@ sed -E '/.*this.httpClient.request.*/{n;s/.*/\{responseType: "blob",/}' -i cd "$DIR_PROJECT_ROOT" URL_EDULINT="https://edulint.com/api/openapi.yaml" FILE_EDULINT="src/api/edulint.yaml" - -if [ ! -f "$FILE_EDULINT" ]; then - wget --output-document="$FILE_EDULINT" "$URL_EDULINT" -fi +wget --output-document="$FILE_EDULINT" "$URL_EDULINT" $cli generate -l typescript-angular -i "$FILE_EDULINT" -o src/api/edulint -c "$DIR_PROJECT_ROOT/swagger-config.json"