openapi-to-graphql-harshith
Version:
Generates a GraphQL schema for a given OpenAPI Specification (OAS)
73 lines (72 loc) • 1.99 kB
TypeScript
/**
* Type definitions for the data created during preprocessing.
*/
import { Operation, DataDefinition } from './operation';
import { InternalOptions } from './options';
import { SecuritySchemeObject, SchemaObject, Oas3 } from './oas3';
export declare type ProcessedSecurityScheme = {
rawName: string;
def: SecuritySchemeObject;
/**
* Stores the names of the authentication credentials
* NOTE: Structure depends on the type of the protocol (basic, API key...)
* NOTE: Mainly used for the AnyAuth viewers
* NOTE: Values are sanitized (see getProcessedSecuritySchemes() in preprocessor.ts)
*/
parameters: {
[]: string;
};
/**
* JSON schema to create the viewer for this security scheme from.
*/
schema: SchemaObject;
/**
* The OAS which this operation originated from
*/
oas: Oas3;
};
export declare type PreprocessingData<TSource, TContext, TArgs> = {
/**
* List of operation objects
*/
operations: {
[]: Operation;
};
/**
* List of Operation objects
*/
callbackOperations: {
[]: Operation;
};
/**
* List of all the used object names to avoid collision
*/
usedTypeNames: string[];
/**
* List of data definitions for JSON schemas already used.
*/
defs: DataDefinition[];
/**
* The security definitions contained in the OAS. References are resolved.
*
* NOTE: Keys are sanitized
* NOTE: Does not contain OAuth 2.0-related security schemes
*/
security: {
[]: ProcessedSecurityScheme;
};
/**
* Mapping between sanitized strings and their original ones
*/
saneMap: {
[]: string;
};
/**
* Options passed to OpenAPI-to-GraphQL by the user
*/
options: InternalOptions<TSource, TContext, TArgs>;
/**
* All of the provided OASs
*/
oass: Oas3[];
};