openapi-specification-types 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/common.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export type StringObject = { [key: string]: string }
2
+ export type AtWillObject = { [key: string]: any }
@@ -0,0 +1,52 @@
1
+ import { AtWillObject, StringObject } from './common'
2
+ import { Definitions } from './definitions'
3
+ import { Schema } from './schema'
4
+
5
+ export interface Components {
6
+ schemas: Definitions
7
+ requestBodies: RequestBodies
8
+ }
9
+
10
+ export interface RequestBodies {
11
+ [name: string]: RequestBody
12
+ }
13
+
14
+ export interface RequestBody {
15
+ description: string
16
+ content: {
17
+ [type: string]: {
18
+ schema: Schema
19
+ example: AtWillObject
20
+ examples: Record<string, AtWillObject>
21
+ encoding: Record<string, AtWillObject>
22
+ }
23
+ }
24
+ required: boolean
25
+ }
26
+
27
+ export interface SecuritySchemes {
28
+ [name: string]: SecurityScheme
29
+ }
30
+
31
+ export interface SecurityScheme {
32
+ type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect'
33
+ description: string
34
+ name: string
35
+ in: 'query' | 'header' | 'cookie'
36
+ scheme: string
37
+ bearerFormat: string
38
+ flows: {
39
+ implicit: OAuthFlow
40
+ password: OAuthFlow
41
+ clientCredentials: OAuthFlow
42
+ authorizationCode: OAuthFlow
43
+ }
44
+ openIdConnectUrl: string
45
+ }
46
+
47
+ interface OAuthFlow {
48
+ authorizationUrl: string
49
+ tokenUrl: string
50
+ refreshUrl: string
51
+ scopes: StringObject
52
+ }
@@ -0,0 +1,28 @@
1
+ import { Properties, Schema } from './schema'
2
+
3
+ export interface Definition {
4
+ type: Schema['type']
5
+ properties: Properties
6
+ required: string[]
7
+ }
8
+
9
+ export interface Definitions {
10
+ [name: string]: Definition
11
+ }
12
+
13
+ export interface SecurityDefinitions {
14
+ api_key: {
15
+ type: string
16
+ name: string
17
+ in: string
18
+ }
19
+ petstore_auth: {
20
+ type: string
21
+ authorizationUrl: string
22
+ flow: string
23
+ scopes: {
24
+ 'read:pets': string
25
+ 'write:pets': string
26
+ }
27
+ }
28
+ }
package/index-v2.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ import { AtWillObject } from './common'
2
+ import { Tag } from './tag'
3
+ import { Paths } from './paths'
4
+ import { Definitions, SecurityDefinitions } from './definitions'
5
+
6
+ export interface OpenAPISpecificationV2 extends AtWillObject {
7
+ swagger: string
8
+ host: string
9
+ basePath: string
10
+ schemes: string[]
11
+ consumes: string[]
12
+ info: {
13
+ description: string
14
+ version: string
15
+ title: string
16
+ termsOfService: string
17
+ contact: Record<'name' | 'url' | 'email', string>
18
+ license: Record<'name' | 'url', string>
19
+ }
20
+
21
+ paths: Paths
22
+ definitions: Definitions
23
+
24
+ securityDefinitions: SecurityDefinitions
25
+ tags: Tag[]
26
+ externalDocs: {
27
+ description: string
28
+ url: string
29
+ }
30
+ }
package/index-v3.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ import { AtWillObject } from './common'
2
+ import { Server } from './server'
3
+ import { Tag } from './tag'
4
+ import { Paths } from './paths'
5
+ import { Components } from './components'
6
+
7
+ export interface OpenAPISpecificationV3 extends AtWillObject {
8
+ openapi: string
9
+ info: {
10
+ description: string
11
+ version: string
12
+ title: string
13
+ termsOfService: string
14
+ contact: Record<'name' | 'url' | 'email', string>
15
+ license: Record<'name' | 'url', string>
16
+ }
17
+ externalDocs: {
18
+ description: string
19
+ url: string
20
+ }
21
+ servers: Server[]
22
+ tags: Tag[]
23
+ paths: Paths
24
+ components: Components
25
+ }
package/index.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ export * from './index-v2'
2
+ export * from './index-v2'
3
+
4
+ export * from './components'
5
+ export * from './definitions'
6
+ export * from './parameter'
7
+ export * from './paths'
8
+ export * from './schema'
9
+ export * from './server'
10
+ export * from './tag'
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "openapi-specification-types",
3
+ "version": "0.0.1",
4
+ "types": "./index.d.ts",
5
+ "main": "index.js",
6
+ "keywords": [
7
+ "openapi",
8
+ "types"
9
+ ],
10
+ "author": "",
11
+ "license": "ISC"
12
+ }
package/parameter.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { Schema } from './schema'
2
+
3
+ export interface Parameter extends Schema {
4
+ name: string
5
+ in: 'body' | 'header' | 'query' | 'path' | 'formData'
6
+ type?: Schema['type']
7
+ description?: string
8
+ required?: boolean
9
+ schema?: Schema
10
+ }
package/paths.d.ts ADDED
@@ -0,0 +1,40 @@
1
+ import { Parameter } from './parameter'
2
+ import { Schema, Properties } from './schema'
3
+
4
+ export interface Paths {
5
+ [path: string]: {
6
+ get: Method
7
+ put: Method
8
+ post: Method
9
+ delete: Method
10
+ options: Method
11
+ head: Method
12
+ patch: Method
13
+ parameters: Parameter[]
14
+ }
15
+ }
16
+
17
+ export interface Method {
18
+ tags: string[]
19
+ summary: string
20
+ description: string
21
+ operationId: string
22
+ consumes: string[]
23
+ produces: string[]
24
+ parameters: Parameter[]
25
+ responses: Responses
26
+ security: Security[]
27
+ }
28
+
29
+ export interface Responses {
30
+ [status: number]: {
31
+ description: string
32
+ headers: Properties
33
+ schema: Schema
34
+ }
35
+ }
36
+
37
+ export interface Security {
38
+ petstore_auth: string[]
39
+ api_key: string[]
40
+ }
package/schema.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ type SchemaNumberType = 'integer' | 'long' | 'float' | 'byte' | 'TypesLong' | 'TypesString' | 'string'
2
+ type SchemaStringType = 'byte' | 'binary' | 'date' | 'dateTime' | 'password'
3
+ type SchemaBooleanType = 'boolean'
4
+ type SchemaObjectType = 'object'
5
+ type SchemaArrayType = 'array'
6
+
7
+ type SchemaType = SchemaNumberType | SchemaStringType | SchemaBooleanType | SchemaObjectType | SchemaArrayType
8
+
9
+ export interface Schema {
10
+ type?: SchemaType | SchemaType[]
11
+ items?: Schema
12
+ additionalProperties?: Schema
13
+ originalRef?: string
14
+ $ref?: string
15
+ required?: boolean
16
+ format?: string
17
+ description?: string
18
+ schema?: Schema
19
+ properties?: Properties
20
+ xml?: { wrapped?: boolean }
21
+ enum?: string[]
22
+ }
23
+
24
+ export interface Properties {
25
+ [name: string]: Schema
26
+ }
package/server.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ export interface Server {
2
+ url: string
3
+ description: string
4
+ variables: Record<string, Variable>
5
+ }
6
+
7
+ export interface Variable {
8
+ enum: string[]
9
+ default: string
10
+ description: string
11
+ }
package/tag.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export interface Tag {
2
+ name: string
3
+ description: string
4
+ externalDocs?: { description: string; url: string }
5
+ }