Skip to content

Commit

Permalink
fix(openspec): remove depreciation annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Mar 16, 2022
1 parent 1873be3 commit 6c5de0a
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 94 deletions.
3 changes: 0 additions & 3 deletions packages/specs/openspec/src/openspec2/OS2Header.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {OS2BaseSchema} from "./OS2Schema";

/**
* @deprecated
*/
export interface OS2Header extends OS2BaseSchema {
/**
* The type of the object. The value MUST be one of `string`, `number`, `integer`, `boolean`, or `array`.
Expand Down
3 changes: 0 additions & 3 deletions packages/specs/openspec/src/openspec2/OS2Operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import {OpenSpecSecurity} from "../common/OpenSpecSecurity";
import {OS2Parameter} from "./OS2Parameter";
import {OS2Response} from "./OS2Response";

/**
* @deprecated
*/
export interface OS2Operation {
/**
* A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
Expand Down
43 changes: 0 additions & 43 deletions packages/specs/openspec/src/openspec2/OS2Parameter.ts
Original file line number Diff line number Diff line change
@@ -1,99 +1,59 @@
import {OpenSpecTypes} from "../common/OpenSpecTypes";
import {OS2BaseSchema, OS2Schema} from "./OS2Schema";

/**
* @deprecated
*/
export type OS2BaseParameter = {
name: string;
in: "body" | "query" | "path" | "header" | "formData";
required?: boolean;
description?: string;
};

/**
* @deprecated
*/
export type OS2BodyParameter = OS2BaseParameter & {
in: "body";
schema?: OS2Schema;
};

/**
* @deprecated
*/
export type OS2GenericFormat = {
type?: OpenSpecTypes;
format?: string;
};

/**
* @deprecated
*/
export type OS2IntegerFormat = {
type: "integer";
format?: "int32" | "int64";
};

/**
* @deprecated
*/
export type OS2NumberFormat = {
type: "number";
format?: "float" | "double";
};

/**
* @deprecated
*/
export type OS2StringFormat = {
type: "string";
format?: "" | "byte" | "binary" | "date" | "date-time" | "password";
};

/**
* @deprecated
*/
export type OS2SchemaFormatConstraints = OS2GenericFormat | OS2IntegerFormat | OS2NumberFormat | OS2StringFormat;
/**
* @deprecated
*/
export type OS2BaseFormatContrainedParameter = OS2BaseParameter & OS2SchemaFormatConstraints;
/**
* @deprecated
*/
export type ParameterCollectionFormat = "csv" | "ssv" | "tsv" | "pipes" | "multi";

/**
* @deprecated
*/
export type OS2QueryParameter = OS2BaseFormatContrainedParameter &
OS2BaseSchema & {
in: "query";
allowEmptyValue?: boolean;
collectionFormat?: ParameterCollectionFormat;
};

/**
* @deprecated
*/
export type OS2PathParameter = OS2BaseFormatContrainedParameter &
OS2BaseSchema & {
in: "path";
required: true;
};

/**
* @deprecated
*/
export type OS2HeaderParameter = OS2BaseFormatContrainedParameter &
OS2BaseSchema & {
in: "header";
};

/**
* @deprecated
*/
export type OS2FormDataParameter = OS2BaseFormatContrainedParameter &
OS2BaseSchema & {
in: "formData";
Expand All @@ -102,7 +62,4 @@ export type OS2FormDataParameter = OS2BaseFormatContrainedParameter &
collectionFormat?: ParameterCollectionFormat;
};

/**
* @deprecated
*/
export type OS2Parameter = OS2BodyParameter | OS2FormDataParameter | OS2QueryParameter | OS2PathParameter | OS2HeaderParameter;
3 changes: 0 additions & 3 deletions packages/specs/openspec/src/openspec2/OS2Paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import {OpenSpecRef} from "../common/OpenSpecRef";
import {OS2Operation} from "./OS2Operation";
import {OS2Parameter} from "./OS2Parameter";

/**
* @deprecated
*/
export interface OS2Paths extends OpenSpecPath<OS2Operation> {
parameters?: (OS2Parameter | OpenSpecRef)[];
}
3 changes: 0 additions & 3 deletions packages/specs/openspec/src/openspec2/OS2Response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import {OpenSpecHash} from "../common/OpenSpecHash";
import {OS2Header} from "./OS2Header";
import {OS2Schema} from "./OS2Schema";

/**
* @deprecated
*/
export interface OS2Response {
/**
* A short description of the response. GFM syntax can be used for rich text representation.
Expand Down
12 changes: 3 additions & 9 deletions packages/specs/openspec/src/openspec2/OS2Schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,22 @@ import {OpenSpecExternalDocs} from "../common/OpenSpecExternalDocs";
import {OpenSpecBaseJsonSchema, OpenSpecJsonSchema} from "../common/OpenSpecJsonSchema";
import {OpenSpecRef} from "../common/OpenSpecRef";
import {OpenSpecXML} from "../common/OpenSpecXML";
/**
* @deprecated
*/

export interface OS2XML {
name?: string;
namespace?: string;
prefix?: string;
attribute?: boolean;
wrapped?: boolean;
}
/**
* @deprecated
*/

export interface OS2BaseSchema extends OpenSpecBaseJsonSchema {
/**
* Required if type is "array". Describes the type of items in the array.
*/
items?: OS2Schema | OpenSpecRef;
}
/**
* @deprecated
*/

export interface OS2Schema extends OpenSpecJsonSchema<OS2Schema> {
/**
* Adds support for polymorphism.
Expand Down
27 changes: 0 additions & 27 deletions packages/specs/openspec/src/openspec2/OS2Security.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {OpenSpecHash} from "../common/OpenSpecHash";

/**
* @deprecated
*/
export interface OS2SecurityBase {
/**
* The type of the security scheme
Expand All @@ -14,25 +11,16 @@ export interface OS2SecurityBase {
description?: string;
}

/**
* @deprecated
*/
export interface OS2SecurityBasic extends OS2SecurityBase {
type: "basic";
}

/**
* @deprecated
*/
export interface OS2SecurityApiKey extends OS2SecurityBase {
type: "apiKey";
name: string;
in: "query" | "header";
}

/**
* @deprecated
*/
export interface OS2SecurityOAuth extends OS2SecurityBase {
type: "oauth2";
flow: "accessCode" | "application" | "implicit" | "password";
Expand All @@ -42,44 +30,29 @@ export interface OS2SecurityOAuth extends OS2SecurityBase {
scopes: OpenSpecHash<string>;
}

/**
* @deprecated
*/
export interface OS2FlowImplicit extends OS2SecurityOAuth {
type: "oauth2";
flow: "implicit";
authorizationUrl: string;
}

/**
* @deprecated
*/
export interface OS2FlowPassword extends OS2SecurityOAuth {
type: "oauth2";
flow: "password";
tokenUrl: string;
}

/**
* @deprecated
*/
export interface OS2FlowApplication extends OS2SecurityOAuth {
type: "oauth2";
flow: "application";
tokenUrl: string;
}

/**
* @deprecated
*/
export interface OS2FlowAccessCode extends OS2SecurityOAuth {
type: "oauth2";
flow: "accessCode";
tokenUrl: string;
authorizationUrl: string;
}

/**
* @deprecated
*/
export type OS2Security = OS2SecurityBasic | OS2FlowAccessCode | OS2FlowApplication | OS2FlowImplicit | OS2FlowPassword | OS2SecurityApiKey;
6 changes: 3 additions & 3 deletions packages/specs/schema/src/utils/generateSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import {mapOpenSpec} from "./mapOpenSpec";
import {getSpec, JsonTokenOptions, SpecSerializerOptions} from "./getSpec";
import {getSpecTypeFromSpec} from "./getSpecType";
import {mergeSpec} from "./mergeSpec";
// @ts-ignore
import Converter from "api-spec-converter";
import {SpecTypes} from "../domain/SpecTypes";

export interface GenerateSpecOptions extends Omit<SpecSerializerOptions, "specType"> {
Expand Down Expand Up @@ -50,7 +48,9 @@ export async function generateSpec({tokens, ...options}: GenerateSpecOptions): P
let controllersSpec = getSpec(tokens, options);

if (specType === SpecTypes.SWAGGER) {
const {spec} = await Converter.convert({
// @ts-ignore
const {convert} = await import("api-spec-converter");
const {spec} = await convert({
from: "openapi_3",
to: "swagger_2",
source: {
Expand Down

0 comments on commit 6c5de0a

Please sign in to comment.