mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 11:23:58 +00:00
Fix any problem
+ added integration test
This commit is contained in:
parent
d5626d02da
commit
d84c1cdfd7
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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<String, String> configProperties() {
|
||||
Map<String, String> 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");
|
||||
}
|
||||
}
|
@ -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
|
@ -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.
|
@ -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<models.ProjectEntity> {
|
||||
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<models.ProjectEntity> {
|
||||
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<models.ProjectList> {
|
||||
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<models.ProjectEntity> {
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1 @@
|
||||
export * from './ProjectApi';
|
@ -0,0 +1,2 @@
|
||||
export * from './api/api';
|
||||
export * from './model/models';
|
@ -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 = <any> 'project',
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
import * as models from './models';
|
||||
|
||||
export interface ProjectEntityLocation {
|
||||
|
||||
|
||||
lat?: number;
|
||||
|
||||
lon?: number;
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
import * as models from './models';
|
||||
|
||||
export interface ProjectList {
|
||||
|
||||
|
||||
contents?: Array<models.ProjectEntity>;
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
export * from './ProjectEntity';
|
||||
export * from './ProjectEntityLocation';
|
||||
export * from './ProjectList';
|
@ -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"
|
||||
}}
|
@ -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"
|
||||
]
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"core-js": "registry:dt/core-js#0.0.0+20160317120654"
|
||||
}
|
||||
}
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user