Skip to content

Commit

Permalink
fix: Correct and improve OpenAPI3 Typescript interface def for Parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsharvey authored and theoomoregbee committed Jun 4, 2020
1 parent aeda736 commit 1a6653b
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions types/openapi.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Reference, Header, Tag, ExternalDocs, XML } from 'swagger-schema-official';
import { Reference, Tag, ExternalDocs, XML } from 'swagger-schema-official';

// This is simply building from OpenApi Specification
// see: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md
Expand Down Expand Up @@ -77,16 +77,32 @@ declare namespace OpenApi {
enum?: any[];
}

export interface Parameter {
name: string;
in: string;
description?: string;
required?: boolean;
deprecated?: boolean;
allowEmptyValue?: boolean;
schema?: UpdatedSchema | Reference;
export type ParameterLocation = 'query' | 'header' | 'path' | 'cookie';

export type ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';

export interface ParameterCommon {
description?: string;
required?: boolean;
deprecated?: boolean;
allowEmptyValue?: boolean;

style?: ParameterStyle;
explode?: boolean;
allowReserved?: boolean;
schema?: UpdatedSchema | Reference;
examples?: Map<string, Example | Reference>;
example?: any;
content?: Record<string, MediaType>;
}

export interface Parameter extends ParameterCommon {
name: string;
in: ParameterLocation;
}

export type Header = ParameterCommon

export interface Example {
summary?: string;
description?: string;
Expand Down

0 comments on commit 1a6653b

Please sign in to comment.