diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java index aa14a565d10..e4e822a5473 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java @@ -13,6 +13,7 @@ import io.swagger.models.properties.ArrayProperty; import io.swagger.models.properties.BooleanProperty; import io.swagger.models.properties.FileProperty; import io.swagger.models.properties.MapProperty; +import io.swagger.models.properties.ObjectProperty; import io.swagger.models.properties.Property; public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCodegen { @@ -114,14 +115,19 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod MapProperty mp = (MapProperty)p; inner = mp.getAdditionalProperties(); return "{ [key: string]: " + this.getTypeDeclaration(inner) + "; }"; + } else if(p instanceof FileProperty || p instanceof ObjectProperty) { + return "any"; } else { - return p instanceof FileProperty ? "any" : super.getTypeDeclaration(p); + return super.getTypeDeclaration(p); } } @Override public String getSwaggerType(Property p) { String swaggerType = super.getSwaggerType(p); + if(languageSpecificPrimitives.contains(swaggerType)) { + return swaggerType; + } return addModelPrefix(swaggerType); } @@ -129,10 +135,13 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod String type = null; if (typeMapping.containsKey(swaggerType)) { type = typeMapping.get(swaggerType); - if (languageSpecificPrimitives.contains(type)) - return type; - } else + } else { + type = swaggerType; + } + + if (!languageSpecificPrimitives.contains(type)) { type = "models." + swaggerType; + } return type; } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypescriptAngular2ArrayAndObjectTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypescriptAngular2ArrayAndObjectTest.java new file mode 100644 index 00000000000..b9a8868a6b8 --- /dev/null +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypescriptAngular2ArrayAndObjectTest.java @@ -0,0 +1,32 @@ +package io.swagger.codegen.typescript.typescriptangular2; + +import java.util.HashMap; +import java.util.Map; + +import io.swagger.codegen.AbstractIntegrationTest; +import io.swagger.codegen.CodegenConfig; +import io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen; +import io.swagger.codegen.testutils.IntegrationTestPathsConfig; + +public class TypescriptAngular2ArrayAndObjectTest extends AbstractIntegrationTest { + + @Override + protected CodegenConfig getCodegenConfig() { + return new TypeScriptAngular2ClientCodegen(); + } + + @Override + protected Map configProperties() { + Map propeties = new HashMap<>(); + propeties.put("npmName", "arrayAndAnyTest"); + propeties.put("npmVersion", "1.0.2"); + propeties.put("snapshot", "false"); + + return propeties; + } + + @Override + protected IntegrationTestPathsConfig getIntegrationTestPathsConfig() { + return new IntegrationTestPathsConfig("typescript/array-and-object"); + } +} diff --git a/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/.swagger-codegen-ignore b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/.swagger-codegen-ignore new file mode 100644 index 00000000000..19d3377182e --- /dev/null +++ b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/README.md b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/README.md new file mode 100644 index 00000000000..85e98e0f9d9 --- /dev/null +++ b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/README.md @@ -0,0 +1,33 @@ +## arrayAndAnyTest@1.0.2 + +### Building + +To build an compile the typescript sources to javascript use: +``` +npm install +npm run build +``` + +### publishing + +First build the package than run ```npm publish``` + +### consuming + +navigate to the folder of your consuming project and run one of next commando's. + +_published:_ + +``` +npm install arrayAndAnyTest@1.0.2 --save +``` + +_unPublished (not recommended):_ + +``` +npm install PATH_TO_GENERATED_PACKAGE --save +``` + +In your angular2 project: + +TODO: paste example. diff --git a/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/api/ProjectApi.ts b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/api/ProjectApi.ts new file mode 100644 index 00000000000..dbcdbe5fb7a --- /dev/null +++ b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/api/ProjectApi.ts @@ -0,0 +1,218 @@ +import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from '@angular/http'; +import {Injectable, Optional} from '@angular/core'; +import {Observable} from 'rxjs/Observable'; +import * as models from '../model/models'; +import 'rxjs/Rx'; + +/* tslint:disable:no-unused-variable member-ordering */ + +'use strict'; + +@Injectable() +export class ProjectApi { + protected basePath = 'https://localhost/v1'; + public defaultHeaders : Headers = new Headers(); + + constructor(protected http: Http, @Optional() basePath: string) { + if (basePath) { + this.basePath = basePath; + } + } + + /** + * Create a Project + * Creates an empty Project + * @param name + * @param address + * @param longitude + * @param latitude + * @param meta + */ + public createProject (name?: string, address?: string, longitude?: number, latitude?: number, meta?: string, extraHttpRequestParams?: any ) : Observable { + const path = this.basePath + '/projects'; + + let queryParameters: any = ""; // This should probably be an object in the future + let headerParams = this.defaultHeaders; + let formParams = new URLSearchParams(); + + headerParams.set('Content-Type', 'application/x-www-form-urlencoded'); + + formParams['name'] = name; + + formParams['address'] = address; + + formParams['longitude'] = longitude; + + formParams['latitude'] = latitude; + + formParams['meta'] = meta; + + let requestOptions: RequestOptionsArgs = { + method: 'POST', + headers: headerParams, + search: queryParameters + }; + requestOptions.body = formParams.toString(); + + return this.http.request(path, requestOptions) + .map((response: Response) => response.json()); + } + + /** + * Delete a Project + * Returns a Project JSON object + * @param id Project id + */ + public deleteProjectById (id: number, extraHttpRequestParams?: any ) : Observable<{}> { + const path = this.basePath + '/projects/{id}' + .replace('{' + 'id' + '}', String(id)); + + let queryParameters: any = ""; // This should probably be an object in the future + let headerParams = this.defaultHeaders; + // verify required parameter 'id' is set + if (!id) { + throw new Error('Missing required parameter id when calling deleteProjectById'); + } + let requestOptions: RequestOptionsArgs = { + method: 'DELETE', + headers: headerParams, + search: queryParameters + }; + + return this.http.request(path, requestOptions) + .map((response: Response) => response.json()); + } + + /** + * Get a Project + * Returns a Project JSON object + * @param id Project id + */ + public getProjectById (id: number, extraHttpRequestParams?: any ) : Observable { + const path = this.basePath + '/projects/{id}' + .replace('{' + 'id' + '}', String(id)); + + let queryParameters: any = ""; // This should probably be an object in the future + let headerParams = this.defaultHeaders; + // verify required parameter 'id' is set + if (!id) { + throw new Error('Missing required parameter id when calling getProjectById'); + } + let requestOptions: RequestOptionsArgs = { + method: 'GET', + headers: headerParams, + search: queryParameters + }; + + return this.http.request(path, requestOptions) + .map((response: Response) => response.json()); + } + + /** + * Get project list + * Returns a Project JSON object + * @param page + * @param perPage + * @param kind + * @param q + * @param filter + * @param latitude Valid with kind as location + * @param longitude Valid with kind as location + * @param scope Valid with kind as location, and between 1~9 + */ + public getProjectList (page?: number, perPage?: number, kind?: string, q?: string, filter?: string, latitude?: number, longitude?: number, scope?: number, extraHttpRequestParams?: any ) : Observable { + const path = this.basePath + '/projects'; + + let queryParameters: any = ""; // This should probably be an object in the future + let headerParams = this.defaultHeaders; + if (page !== undefined) { + queryParameters['page'] = page; + } + + if (perPage !== undefined) { + queryParameters['per_page'] = perPage; + } + + if (kind !== undefined) { + queryParameters['kind'] = kind; + } + + if (q !== undefined) { + queryParameters['q'] = q; + } + + if (filter !== undefined) { + queryParameters['filter'] = filter; + } + + if (latitude !== undefined) { + queryParameters['latitude'] = latitude; + } + + if (longitude !== undefined) { + queryParameters['longitude'] = longitude; + } + + if (scope !== undefined) { + queryParameters['scope'] = scope; + } + + let requestOptions: RequestOptionsArgs = { + method: 'GET', + headers: headerParams, + search: queryParameters + }; + + return this.http.request(path, requestOptions) + .map((response: Response) => response.json()); + } + + /** + * Update project + * + * @param id Project id + * @param name User ID + * @param address Address + * @param longitude + * @param latitude + * @param meta + * @param thumbnail Project thumbnail + */ + public updateProject (id: number, name?: string, address?: string, longitude?: number, latitude?: number, meta?: string, thumbnail?: any, extraHttpRequestParams?: any ) : Observable { + const path = this.basePath + '/projects/{id}' + .replace('{' + 'id' + '}', String(id)); + + let queryParameters: any = ""; // This should probably be an object in the future + let headerParams = this.defaultHeaders; + let formParams = new URLSearchParams(); + + // verify required parameter 'id' is set + if (!id) { + throw new Error('Missing required parameter id when calling updateProject'); + } + headerParams.set('Content-Type', 'application/x-www-form-urlencoded'); + + formParams['name'] = name; + + formParams['address'] = address; + + formParams['longitude'] = longitude; + + formParams['latitude'] = latitude; + + formParams['meta'] = meta; + + formParams['thumbnail'] = thumbnail; + + let requestOptions: RequestOptionsArgs = { + method: 'PUT', + headers: headerParams, + search: queryParameters + }; + requestOptions.body = formParams.toString(); + + return this.http.request(path, requestOptions) + .map((response: Response) => response.json()); + } + +} diff --git a/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/api/api.ts b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/api/api.ts new file mode 100644 index 00000000000..d919ee6d629 --- /dev/null +++ b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/api/api.ts @@ -0,0 +1 @@ +export * from './ProjectApi'; diff --git a/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/index.ts b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/index.ts new file mode 100644 index 00000000000..557365516ad --- /dev/null +++ b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/index.ts @@ -0,0 +1,2 @@ +export * from './api/api'; +export * from './model/models'; \ No newline at end of file diff --git a/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/model/ProjectEntity.ts b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/model/ProjectEntity.ts new file mode 100644 index 00000000000..dc3bd6bdce9 --- /dev/null +++ b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/model/ProjectEntity.ts @@ -0,0 +1,32 @@ +'use strict'; +import * as models from './models'; + +export interface ProjectEntity { + + + id?: number; + + kind?: ProjectEntity.KindEnum; + + thumbnailUrl?: string; + + name?: string; + + state?: string; + + meta?: any; + + location?: models.ProjectEntityLocation; + + createdAt?: Date; + + updatedAt?: Date; + + publishedAt?: Date; +} +export namespace ProjectEntity { + + export enum KindEnum { + project = 'project', + } +} diff --git a/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/model/ProjectEntityLocation.ts b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/model/ProjectEntityLocation.ts new file mode 100644 index 00000000000..81fd66511a6 --- /dev/null +++ b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/model/ProjectEntityLocation.ts @@ -0,0 +1,10 @@ +'use strict'; +import * as models from './models'; + +export interface ProjectEntityLocation { + + + lat?: number; + + lon?: number; +} diff --git a/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/model/ProjectList.ts b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/model/ProjectList.ts new file mode 100644 index 00000000000..a8a98e93a75 --- /dev/null +++ b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/model/ProjectList.ts @@ -0,0 +1,8 @@ +'use strict'; +import * as models from './models'; + +export interface ProjectList { + + + contents?: Array; +} diff --git a/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/model/models.ts b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/model/models.ts new file mode 100644 index 00000000000..b917c007157 --- /dev/null +++ b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/model/models.ts @@ -0,0 +1,3 @@ +export * from './ProjectEntity'; +export * from './ProjectEntityLocation'; +export * from './ProjectList'; diff --git a/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/package.json b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/package.json new file mode 100644 index 00000000000..83a9a586ab9 --- /dev/null +++ b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/package.json @@ -0,0 +1,36 @@ +{ + "name": "arrayAndAnyTest", + "version": "1.0.2", + "description": "swagger client for arrayAndAnyTest", + "author": "Swagger Codegen Contributors", + "keywords": [ + "swagger-client" + ], + "license": "MIT", + "files": [ + "lib" + ], + "main": "./lib/index.js", + "typings": "./lib/index.d.ts", + "scripts": { + "build": "typings install && tsc" + }, + "peerDependencies": { + "@angular/core": "^2.0.0-rc.1", + "@angular/http": "^2.0.0-rc.1" + }, + "devDependencies": { + "@angular/common": "^2.0.0-rc.1", + "@angular/compiler": "^2.0.0-rc.1", + "@angular/core": "^2.0.0-rc.1", + "@angular/http": "^2.0.0-rc.1", + "@angular/platform-browser": "^2.0.0-rc.1", + "@angular/platform-browser-dynamic": "^2.0.0-rc.1", + "core-js": "^2.3.0", + "rxjs": "^5.0.0-beta.6", + "zone.js": "^0.6.12", + "typescript": "^1.8.10", + "typings": "^0.8.1", + "es6-shim": "^0.35.0", + "es7-reflect-metadata": "^1.6.0" + }} diff --git a/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/tsconfig.json b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/tsconfig.json new file mode 100644 index 00000000000..07fbdf7e1b1 --- /dev/null +++ b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "noImplicitAny": false, + "suppressImplicitAnyIndexErrors": true, + "target": "es5", + "module": "commonjs", + "moduleResolution": "node", + "removeComments": true, + "sourceMap": true, + "outDir": "./lib", + "noLib": false, + "declaration": true + }, + "exclude": [ + "node_modules", + "typings/main.d.ts", + "typings/main", + "lib" + ], + "filesGlob": [ + "./model/*.ts", + "./api/*.ts", + "typings/browser.d.ts" + ] +} diff --git a/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/typings.json b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/typings.json new file mode 100644 index 00000000000..0848dcffe31 --- /dev/null +++ b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-expected/typings.json @@ -0,0 +1,5 @@ +{ + "ambientDependencies": { + "core-js": "registry:dt/core-js#0.0.0+20160317120654" + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-spec.json b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-spec.json new file mode 100644 index 00000000000..366cbb9cb39 --- /dev/null +++ b/modules/swagger-codegen/src/test/resources/integrationtests/typescript/array-and-object-spec.json @@ -0,0 +1,570 @@ +{ + "swagger": "2.0", + "info": + { + "version": "1.7.0", + "title": "Cupix API", + "contact": + { + "name": "inska.lee@cupix.com" + } + }, + "basePath": "/v1", + "consumes": + [ + "application/json" + ], + "produces": + [ + "application/json" + ], + "schemes": + [ + "https" + ], + "paths": + { + "/projects": + { + "post": + { + "tags": + [ + "Project" + ], + "summary": "Create a Project", + "operationId": "create_project", + "description": "Creates an empty Project", + "consumes": + [ + "application/x-www-form-urlencoded" + ], + "produces": + [ + "application/json" + ], + "parameters": + [ + + { + "name": "name", + "type": "string", + "in": "formData" + }, + + { + "name": "address", + "type": "string", + "in": "formData" + }, + + { + "name": "longitude", + "type": "number", + "format": "float", + "in": "formData" + }, + + { + "name": "latitude", + "type": "number", + "format": "float", + "in": "formData" + }, + + { + "name": "meta", + "type": "string", + "in": "formData" + } + ], + "responses": + { + "200": + { + "description": "Project information", + "schema": + { + "$ref": "#/definitions/ProjectEntity" + } + }, + "400": + { + "description": "Bad Request", + "schema": + { + "$ref": "#/definitions/Error" + } + }, + "401": + { + "description": "Unauthorized request" + }, + "403": + { + "description": "Forbidden" + }, + "404": + { + "description": "Project not found" + } + } + }, + "get": + { + "tags": + [ + "Project" + ], + "summary": "Get project list", + "operationId": "get_project_list", + "description": "Returns a Project JSON object", + "produces": + [ + "application/json" + ], + "security": + [ + + { + "key": + [ + + ] + }, + + { + "token": + [ + + ] + } + ], + "parameters": + [ + + { + "name": "page", + "type": "integer", + "format": "int32", + "in": "query" + }, + + { + "name": "per_page", + "type": "integer", + "format": "int32", + "in": "query" + }, + + { + "name": "kind", + "type": "string", + "in": "query", + "enum": + [ + "my_models", + "published", + "location" + ] + }, + + { + "name": "q", + "type": "string", + "in": "query" + }, + + { + "name": "filter", + "type": "string", + "in": "query" + }, + + { + "name": "latitude", + "in": "query", + "type": "number", + "format": "float", + "description": "Valid with kind as location" + }, + + { + "name": "longitude", + "in": "query", + "type": "number", + "format": "float", + "description": "Valid with kind as location" + }, + + { + "name": "scope", + "in": "query", + "type": "integer", + "description": "Valid with kind as location, and between 1~9" + } + ], + "responses": + { + "200": + { + "description": "Project list", + "schema": + { + "$ref": "#/definitions/ProjectList" + } + }, + "400": + { + "description": "Bad Request", + "schema": + { + "$ref": "#/definitions/Error" + } + }, + "401": + { + "description": "Unauthorized request" + }, + "403": + { + "description": "Forbidden" + }, + "404": + { + "description": "Project not found" + } + } + } + }, + "/projects/{id}": + { + "get": + { + "tags": + [ + "Project" + ], + "summary": "Get a Project", + "operationId": "get_project_by_id", + "description": "Returns a Project JSON object", + "produces": + [ + "application/json" + ], + "parameters": + [ + + { + "name": "id", + "in": "path", + "description": "Project id", + "required": true, + "type": "integer", + "format": "int32" + } + ], + "responses": + { + "200": + { + "description": "Project information", + "schema": + { + "$ref": "#/definitions/ProjectEntity" + } + }, + "400": + { + "description": "Bad Request", + "schema": + { + "$ref": "#/definitions/Error" + } + }, + "401": + { + "description": "Unauthorized request" + }, + "403": + { + "description": "Forbidden" + }, + "404": + { + "description": "Project not found" + } + } + }, + "put": + { + "tags": + [ + "Project" + ], + "summary": "Update project", + "operationId": "update_project", + "consumes": + [ + "multipart/form-data" + ], + "produces": + [ + "application/json" + ], + "parameters": + [ + + { + "name": "id", + "in": "path", + "description": "Project id", + "required": true, + "type": "integer", + "format": "int32" + }, + + { + "name": "name", + "in": "formData", + "description": "User ID", + "type": "string" + }, + + { + "name": "address", + "in": "formData", + "description": "Address", + "type": "string" + }, + + { + "name": "longitude", + "type": "number", + "format": "float", + "in": "formData" + }, + + { + "name": "latitude", + "type": "number", + "format": "float", + "in": "formData" + }, + + { + "name": "meta", + "type": "string", + "in": "formData" + }, + + { + "name": "thumbnail", + "in": "formData", + "description": "Project thumbnail", + "type": "file" + } + ], + "responses": + { + "200": + { + "description": "Project information", + "schema": + { + "$ref": "#/definitions/ProjectEntity" + } + }, + "400": + { + "description": "Bad Request", + "schema": + { + "$ref": "#/definitions/Error" + } + }, + "401": + { + "description": "Unauthorized request" + }, + "403": + { + "description": "Forbidden" + }, + "404": + { + "description": "Project not found" + } + } + }, + "delete": + { + "tags": + [ + "Project" + ], + "summary": "Delete a Project", + "operationId": "delete_project_by_id", + "description": "Returns a Project JSON object", + "produces": + [ + "application/json" + ], + "parameters": + [ + + { + "name": "id", + "in": "path", + "description": "Project id", + "required": true, + "type": "integer", + "format": "int32" + } + ], + "security": + [ + + { + "key": + [ + + ] + }, + + { + "token": + [ + + ] + } + ], + "responses": + { + "200": + { + "description": "Empty" + }, + "204": + { + "description": "Deleted" + }, + "400": + { + "description": "Bad Request", + "schema": + { + "$ref": "#/definitions/Error" + } + }, + "401": + { + "description": "Unauthorized request" + }, + "403": + { + "description": "Forbidden" + }, + "404": + { + "description": "Project not found" + } + } + } + } + }, + "definitions": + { + "ProjectList": + { + "type": "object", + "required": + [ + "contents" + ], + "properties": + { + "contents": + { + "type": "array", + "items": + { + "$ref": "#/definitions/ProjectEntity" + } + } + } + }, + "ProjectEntity": + { + "type": "object", + "required": + [ + "id" + ], + "properties": + { + "id": + { + "type": "integer", + "format": "int32" + }, + "kind": + { + "type": "string", + "enum": + [ + "project" + ] + }, + "thumbnail_url": + { + "type": "string" + }, + "name": + { + "type": "string" + }, + "state": + { + "type": "string" + }, + "meta": + { + "type": "object" + }, + "location": + { + "type": "object", + "properties": + { + "lat": + { + "type": "number", + "format": "float" + }, + "lon": + { + "type": "number", + "format": "float" + } + } + }, + "created_at": + { + "type": "string", + "format": "date-time" + }, + "updated_at": + { + "type": "string", + "format": "date-time" + }, + "published_at": + { + "type": "string", + "format": "date-time" + } + } + } + } +} \ No newline at end of file