mirror of
https://github.com/ferdikoomen/openapi-typescript-codegen.git
synced 2025-12-08 20:16:21 +00:00
- Removed type for now
This commit is contained in:
parent
1b9de75df6
commit
b3ca22ac8f
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "openapi-typescript-codegen",
|
||||
"version": "0.1.3",
|
||||
"version": "0.1.6",
|
||||
"description": "NodeJS library that generates Typescript or Javascript clients based on the OpenAPI specification.",
|
||||
"author": "Ferdi Koomen",
|
||||
"homepage": "https://github.com/ferdikoomen/openapi-typescript-codegen",
|
||||
|
||||
@ -4,11 +4,11 @@
|
||||
/* eslint-disable */
|
||||
/* prettier-ignore */
|
||||
|
||||
import {getFormData} from './getFormData';
|
||||
import {getQueryString} from './getQueryString';
|
||||
import {OpenAPI} from './OpenAPI';
|
||||
import {requestUsingFetch} from './requestUsingFetch';
|
||||
import {requestUsingXHR} from './requestUsingXHR';
|
||||
import { getFormData } from './getFormData';
|
||||
import { getQueryString } from './getQueryString';
|
||||
import { OpenAPI } from './OpenAPI';
|
||||
import { requestUsingFetch } from './requestUsingFetch';
|
||||
import { requestUsingXHR } from './requestUsingXHR';
|
||||
|
||||
/**
|
||||
* Create the request.
|
||||
@ -23,14 +23,14 @@ export async function request(options) {
|
||||
// Create request headers
|
||||
const headers = new Headers({
|
||||
...options.headers,
|
||||
Accept: 'application/json'
|
||||
Accept: 'application/json',
|
||||
});
|
||||
|
||||
// Create request settings
|
||||
const request = {
|
||||
headers,
|
||||
method: options.method,
|
||||
credentials: 'same-origin'
|
||||
credentials: 'same-origin',
|
||||
};
|
||||
|
||||
// If we have a bearer token then we set the authentication header.
|
||||
|
||||
@ -22,7 +22,7 @@ export async function requestUsingFetch(url, request) {
|
||||
ok: response.ok,
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
body: null
|
||||
body: null,
|
||||
};
|
||||
|
||||
// Try to parse the content for any response status code.
|
||||
|
||||
@ -38,7 +38,7 @@ export async function requestUsingXHR(url, request) {
|
||||
ok: isSuccess(xhr.status),
|
||||
status: xhr.status,
|
||||
statusText: xhr.statusText,
|
||||
body: null
|
||||
body: null,
|
||||
};
|
||||
|
||||
// Try to parse the content for any response status code.
|
||||
|
||||
@ -8,10 +8,7 @@ export let Dictionary;
|
||||
(function (Dictionary) {
|
||||
|
||||
Dictionary.definition = {
|
||||
type: 'Dictionary',
|
||||
item: {
|
||||
type: 'any'
|
||||
}
|
||||
type: 'Dictionary'
|
||||
};
|
||||
|
||||
})(Dictionary || (Dictionary = {}));
|
||||
|
||||
@ -1,12 +1,5 @@
|
||||
{
|
||||
type: 'Array',
|
||||
{{#if link~}}
|
||||
item: {{>definition link}},
|
||||
{{else}}
|
||||
item: {
|
||||
type: '{{{base}}}',
|
||||
},
|
||||
{{/if}}
|
||||
{{#if isReadOnly~}}
|
||||
isReadOnly: {{{isReadOnly}}},
|
||||
{{/if}}
|
||||
|
||||
@ -1,12 +1,5 @@
|
||||
{
|
||||
type: 'Dictionary',
|
||||
{{#if link~}}
|
||||
item: {{>definition link}},
|
||||
{{else}}
|
||||
item: {
|
||||
type: '{{{base}}}',
|
||||
},
|
||||
{{/if}}
|
||||
{{#if isReadOnly~}}
|
||||
isReadOnly: {{{isReadOnly}}},
|
||||
{{/if}}
|
||||
|
||||
@ -1,7 +1,16 @@
|
||||
{
|
||||
{{#each properties}}
|
||||
{{{name}}}: {{>definition}},
|
||||
{{/each}}
|
||||
properties: {
|
||||
{{#if extends}}
|
||||
{{#each extends}}
|
||||
...{{{this}}}.definition.properties,
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
{{#if properties}}
|
||||
{{#each properties}}
|
||||
{{{name}}}: {{>definition}},
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
},
|
||||
{{#if isReadOnly~}}
|
||||
isReadOnly: {{{isReadOnly}}},
|
||||
{{/if}}
|
||||
|
||||
@ -3,14 +3,14 @@
|
||||
/* eslint-disable */
|
||||
/* prettier-ignore */
|
||||
|
||||
import { Dictionary } from "../models/Dictionary";
|
||||
import { Dictionary } from '../models/Dictionary';
|
||||
|
||||
type FieldDefinition = {
|
||||
export type FieldDefinition = {
|
||||
readonly type?: string;
|
||||
readonly isReadOnly?: boolean;
|
||||
readonly isRequired?: boolean;
|
||||
readonly isNullable?: boolean;
|
||||
readonly format?: 'int32' | 'int64' | 'float' | 'double' | 'string' | 'boolean' | 'byte' | 'binary' | 'date' | 'date-time' | 'password';
|
||||
readonly format?: string;
|
||||
readonly maximum?: number;
|
||||
readonly exclusiveMaximum?: boolean;
|
||||
readonly minimum?: number;
|
||||
@ -35,8 +35,8 @@ type DictionaryDefinition<T> = FieldDefinition & {
|
||||
}
|
||||
|
||||
type ObjectDefinition<T> = FieldDefinition & {
|
||||
readonly [K in keyof T]: Definition<T[K]>;
|
||||
}
|
||||
readonly [K in keyof T]: Definition<T[K]>;
|
||||
}
|
||||
|
||||
export type Definition<T> =
|
||||
T extends string ? FieldDefinition :
|
||||
|
||||
@ -3,13 +3,13 @@
|
||||
/* eslint-disable */
|
||||
/* prettier-ignore */
|
||||
|
||||
import {getFormData} from './getFormData';
|
||||
import {getQueryString} from './getQueryString';
|
||||
import {OpenAPI} from './OpenAPI';
|
||||
import {RequestOptions} from './RequestOptions';
|
||||
import {requestUsingFetch} from './requestUsingFetch';
|
||||
import {requestUsingXHR} from './requestUsingXHR';
|
||||
import {Result} from './Result';
|
||||
import { getFormData } from './getFormData';
|
||||
import { getQueryString } from './getQueryString';
|
||||
import { OpenAPI } from './OpenAPI';
|
||||
import { RequestOptions } from './RequestOptions';
|
||||
import { requestUsingFetch } from './requestUsingFetch';
|
||||
import { requestUsingXHR } from './requestUsingXHR';
|
||||
import { Result } from './Result';
|
||||
|
||||
/**
|
||||
* Create the request.
|
||||
@ -24,14 +24,14 @@ export async function request(options: Readonly<RequestOptions>): Promise<Result
|
||||
// Create request headers
|
||||
const headers = new Headers({
|
||||
...options.headers,
|
||||
Accept: 'application/json'
|
||||
Accept: 'application/json',
|
||||
});
|
||||
|
||||
// Create request settings
|
||||
const request: RequestInit = {
|
||||
headers,
|
||||
method: options.method,
|
||||
credentials: 'same-origin'
|
||||
credentials: 'same-origin',
|
||||
};
|
||||
|
||||
// If we have a bearer token then we set the authentication header.
|
||||
@ -75,7 +75,7 @@ export async function request(options: Readonly<RequestOptions>): Promise<Result
|
||||
ok: false,
|
||||
status: 0,
|
||||
statusText: '',
|
||||
body: error
|
||||
body: error,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ export async function requestUsingFetch(url: string, request: Readonly<RequestIn
|
||||
ok: response.ok,
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
body: null
|
||||
body: null,
|
||||
};
|
||||
|
||||
// Try to parse the content for any response status code.
|
||||
|
||||
@ -38,7 +38,7 @@ export async function requestUsingXHR(url: string, request: Readonly<RequestInit
|
||||
ok: isSuccess(xhr.status),
|
||||
status: xhr.status,
|
||||
statusText: xhr.statusText,
|
||||
body: null
|
||||
body: null,
|
||||
};
|
||||
|
||||
// Try to parse the content for any response status code.
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
/* prettier-ignore */
|
||||
|
||||
export { ApiError } from './core/ApiError';
|
||||
export { Definition } from './core/Definition';
|
||||
export { isSuccess } from './core/isSuccess';
|
||||
export { OpenAPI } from './core/OpenAPI';
|
||||
{{#if models}}
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
/* eslint-disable */
|
||||
/* prettier-ignore */
|
||||
|
||||
import { Definition } from '../core/Definition';
|
||||
{{#if imports}}
|
||||
{{#each imports}}
|
||||
import { {{{this}}} } from '../models/{{{this}}}';
|
||||
|
||||
@ -3,25 +3,14 @@
|
||||
/* eslint-disable */
|
||||
/* prettier-ignore */
|
||||
|
||||
import { Definition } from '../core/Definition';
|
||||
|
||||
export interface Dictionary<T> {
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
readonly __type: T,
|
||||
|
||||
export type Dictionary<T> = {
|
||||
[key: string]: T;
|
||||
}
|
||||
|
||||
export namespace Dictionary {
|
||||
|
||||
export const definition: Definition<Dictionary<any>> = {
|
||||
type: 'Dictionary',
|
||||
item: {
|
||||
type: 'any'
|
||||
}
|
||||
export const definition = {
|
||||
type: 'Dictionary'
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -1,12 +1,5 @@
|
||||
{
|
||||
type: 'Array',
|
||||
{{#if link~}}
|
||||
item: {{>definition link}},
|
||||
{{else}}
|
||||
item: {
|
||||
type: '{{{base}}}',
|
||||
},
|
||||
{{/if}}
|
||||
{{#if isReadOnly~}}
|
||||
isReadOnly: {{{isReadOnly}}},
|
||||
{{/if}}
|
||||
|
||||
@ -1,12 +1,5 @@
|
||||
{
|
||||
type: 'Dictionary',
|
||||
{{#if link~}}
|
||||
item: {{>definition link}},
|
||||
{{else}}
|
||||
item: {
|
||||
type: '{{{base}}}',
|
||||
},
|
||||
{{/if}}
|
||||
{{#if isReadOnly~}}
|
||||
isReadOnly: {{{isReadOnly}}},
|
||||
{{/if}}
|
||||
|
||||
@ -1,7 +1,16 @@
|
||||
{
|
||||
{{#each properties}}
|
||||
{{{name}}}: {{>definition}},
|
||||
{{/each}}
|
||||
properties: {
|
||||
{{#if extends}}
|
||||
{{#each extends}}
|
||||
...{{{this}}}.definition.properties,
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
{{#if properties}}
|
||||
{{#each properties}}
|
||||
{{{name}}}: {{>definition}},
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
},
|
||||
{{#if isReadOnly~}}
|
||||
isReadOnly: {{{isReadOnly}}},
|
||||
{{/if}}
|
||||
|
||||
@ -11,6 +11,6 @@ export enum {{{name}}} {
|
||||
|
||||
export namespace {{{name}}} {
|
||||
|
||||
export const definition: Definition<{{{name}}}> = {{>definition}};
|
||||
export const definition = {{>definition}};
|
||||
|
||||
}
|
||||
|
||||
@ -7,6 +7,6 @@ export type {{{name}}} = {{>type}};
|
||||
|
||||
export namespace {{{name}}} {
|
||||
|
||||
export const definition: Definition<{{{name}}}> = {{>definition}};
|
||||
export const definition = {{>definition}};
|
||||
|
||||
}
|
||||
|
||||
@ -31,6 +31,6 @@ export namespace {{{name}}} {
|
||||
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
export const definition: Definition<{{{name}}}> = {{>definition}};
|
||||
export const definition = {{>definition}};
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -671,7 +671,7 @@
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"prop": {
|
||||
"$ref": "#/definitions/ModelWithString"
|
||||
"$ref": "#/definitions/ModelWithProperties"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -834,7 +834,7 @@
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"prop": {
|
||||
"$ref": "#/components/schemas/ModelWithString"
|
||||
"$ref": "#/components/schemas/ModelWithProperties"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user