Fill in more example values for OpenAPI schema

This commit is contained in:
Tuan Dang
2023-01-16 10:13:56 +07:00
parent da251d3d2d
commit 2ae617cda6
5 changed files with 96 additions and 114 deletions
+32 -32
View File
@@ -3582,39 +3582,39 @@
}, },
"email": { "email": {
"type": "string", "type": "string",
"example": "" "example": "[email protected]"
}, },
"firstName": { "firstName": {
"type": "string", "type": "string",
"example": "" "example": "John"
}, },
"lastName": { "lastName": {
"type": "string", "type": "string",
"example": "" "example": "Doe"
}, },
"publicKey": { "publicKey": {
"type": "string", "type": "string",
"example": "" "example": "johns_nacl_public_key"
}, },
"encryptedPrivateKey": { "encryptedPrivateKey": {
"type": "string", "type": "string",
"example": "" "example": "johns_enc_nacl_private_key"
}, },
"iv": { "iv": {
"type": "string", "type": "string",
"example": "" "example": "iv_of_enc_nacl_private_key"
}, },
"tag": { "tag": {
"type": "string", "type": "string",
"example": "" "example": "tag_of_enc_nacl_private_key"
}, },
"updatedAt": { "updatedAt": {
"type": "string", "type": "string",
"example": "" "example": "2023-01-13T14:16:12.210Z"
}, },
"createdAt": { "createdAt": {
"type": "string", "type": "string",
"example": "" "example": "2023-01-13T14:16:12.210Z"
} }
} }
}, },
@@ -3630,27 +3630,27 @@
}, },
"email": { "email": {
"type": "string", "type": "string",
"example": "" "example": "[email protected]"
}, },
"firstName": { "firstName": {
"type": "string", "type": "string",
"example": "" "example": "John"
}, },
"lastName": { "lastName": {
"type": "string", "type": "string",
"example": "" "example": "Doe"
}, },
"publicKey": { "publicKey": {
"type": "string", "type": "string",
"example": "" "example": "johns_nacl_public_key"
}, },
"updatedAt": { "updatedAt": {
"type": "string", "type": "string",
"example": "" "example": "2023-01-13T14:16:12.210Z"
}, },
"createdAt": { "createdAt": {
"type": "string", "type": "string",
"example": "" "example": "2023-01-13T14:16:12.210Z"
} }
} }
}, },
@@ -3676,27 +3676,27 @@
}, },
"email": { "email": {
"type": "string", "type": "string",
"example": "" "example": "[email protected]"
}, },
"firstName": { "firstName": {
"type": "string", "type": "string",
"example": "" "example": "John"
}, },
"lastName": { "lastName": {
"type": "string", "type": "string",
"example": "" "example": "Doe"
}, },
"publicKey": { "publicKey": {
"type": "string", "type": "string",
"example": "" "example": "johns_nacl_public_key"
}, },
"updatedAt": { "updatedAt": {
"type": "string", "type": "string",
"example": "" "example": "2023-01-13T14:16:12.210Z"
}, },
"createdAt": { "createdAt": {
"type": "string", "type": "string",
"example": "" "example": "2023-01-13T14:16:12.210Z"
} }
} }
}, },
@@ -3723,7 +3723,7 @@
}, },
"name": { "name": {
"type": "string", "type": "string",
"example": "" "example": "Acme Corp."
}, },
"customerId": { "customerId": {
"type": "string", "type": "string",
@@ -3776,7 +3776,7 @@
"properties": { "properties": {
"publicKey": { "publicKey": {
"type": "string", "type": "string",
"example": "" "example": "senders_nacl_public_key"
} }
} }
}, },
@@ -3938,11 +3938,11 @@
}, },
"updatedAt": { "updatedAt": {
"type": "string", "type": "string",
"example": "" "example": "2023-01-13T14:16:12.210Z"
}, },
"createdAt": { "createdAt": {
"type": "string", "type": "string",
"example": "" "example": "2023-01-13T14:16:12.210Z"
} }
} }
}, },
@@ -3962,15 +3962,15 @@
}, },
"email": { "email": {
"type": "string", "type": "string",
"example": "" "example": "[email protected]"
}, },
"firstName": { "firstName": {
"type": "string", "type": "string",
"example": "" "example": "John"
}, },
"lastName": { "lastName": {
"type": "string", "type": "string",
"example": "" "example": "Doe"
} }
} }
}, },
@@ -4033,11 +4033,11 @@
}, },
"updatedAt": { "updatedAt": {
"type": "string", "type": "string",
"example": "" "example": "2023-01-13T14:16:12.210Z"
}, },
"createdAt": { "createdAt": {
"type": "string", "type": "string",
"example": "" "example": "2023-01-13T14:16:12.210Z"
} }
} }
}, },
@@ -4087,7 +4087,7 @@
}, },
"type": { "type": {
"type": "string", "type": "string",
"example": "" "example": "shared"
}, },
"user": { "user": {
"type": "string", "type": "string",
@@ -4095,7 +4095,7 @@
}, },
"environment": { "environment": {
"type": "string", "type": "string",
"example": "" "example": "dev"
}, },
"isDeleted": { "isDeleted": {
"type": "string", "type": "string",
+32 -33
View File
@@ -2,7 +2,6 @@
const swaggerAutogen = require('swagger-autogen')({ openapi: '3.0.0' }); const swaggerAutogen = require('swagger-autogen')({ openapi: '3.0.0' });
const fs = require('fs').promises; const fs = require('fs').promises;
const yaml = require('js-yaml'); const yaml = require('js-yaml');
const { secretSchema } = require('./schemas/index.ts');
/** /**
* Generates OpenAPI specs for all Infisical API endpoints: * Generates OpenAPI specs for all Infisical API endpoints:
@@ -43,25 +42,25 @@ const generateOpenAPISpec = async () => {
definitions: { definitions: {
CurrentUser: { CurrentUser: {
_id: '', _id: '',
email: '', email: '[email protected]',
firstName: '', firstName: 'John',
lastName: '', lastName: 'Doe',
publicKey: '', publicKey: 'johns_nacl_public_key',
encryptedPrivateKey: '', encryptedPrivateKey: 'johns_enc_nacl_private_key',
iv: '', iv: 'iv_of_enc_nacl_private_key',
tag: '', tag: 'tag_of_enc_nacl_private_key',
updatedAt: '', updatedAt: '2023-01-13T14:16:12.210Z',
createdAt: '' createdAt: '2023-01-13T14:16:12.210Z'
}, },
Membership: { Membership: {
user: { user: {
_id: '', _id: '',
email: '', email: '[email protected]',
firstName: '', firstName: 'John',
lastName: '', lastName: 'Doe',
publicKey: '', publicKey: 'johns_nacl_public_key',
updatedAt: '', updatedAt: '2023-01-13T14:16:12.210Z',
createdAt: '' createdAt: '2023-01-13T14:16:12.210Z'
}, },
workspace: '', workspace: '',
role: 'admin' role: 'admin'
@@ -69,12 +68,12 @@ const generateOpenAPISpec = async () => {
MembershipOrg: { MembershipOrg: {
user: { user: {
_id: '', _id: '',
email: '', email: '[email protected]',
firstName: '', firstName: 'John',
lastName: '', lastName: 'Doe',
publicKey: '', publicKey: 'johns_nacl_public_key',
updatedAt: '', updatedAt: '2023-01-13T14:16:12.210Z',
createdAt: '' createdAt: '2023-01-13T14:16:12.210Z'
}, },
organization: '', organization: '',
role: 'owner', role: 'owner',
@@ -82,7 +81,7 @@ const generateOpenAPISpec = async () => {
}, },
Organization: { Organization: {
_id: '', _id: '',
name: '', name: 'Acme Corp.',
customerId: '' customerId: ''
}, },
Project: { Project: {
@@ -97,7 +96,7 @@ const generateOpenAPISpec = async () => {
encryptedkey: '', encryptedkey: '',
nonce: '', nonce: '',
sender: { sender: {
publicKey: '' publicKey: 'senders_nacl_public_key'
}, },
receiver: '', receiver: '',
workspace: '' workspace: ''
@@ -141,16 +140,16 @@ const generateOpenAPISpec = async () => {
secretCommentCiphertext: '', secretCommentCiphertext: '',
secretCommentIV: '', secretCommentIV: '',
secretCommentTag: '', secretCommentTag: '',
updatedAt: '', updatedAt: '2023-01-13T14:16:12.210Z',
createdAt: '' createdAt: '2023-01-13T14:16:12.210Z'
}, },
Log: { Log: {
_id: '', _id: '',
user: { user: {
_id: '', _id: '',
email: '', email: '[email protected]',
firstName: '', firstName: 'John',
lastName: '' lastName: 'Doe'
}, },
workspace: '', workspace: '',
actionNames: [ actionNames: [
@@ -171,8 +170,8 @@ const generateOpenAPISpec = async () => {
], ],
channel: 'cli', channel: 'cli',
ipAddress: '192.168.0.1', ipAddress: '192.168.0.1',
updatedAt: '', updatedAt: '2023-01-13T14:16:12.210Z',
createdAt: '' createdAt: '2023-01-13T14:16:12.210Z'
}, },
SecretSnapshot: { SecretSnapshot: {
workspace: '', workspace: '',
@@ -188,9 +187,9 @@ const generateOpenAPISpec = async () => {
secret: '', secret: '',
version: 1, version: 1,
workspace: '', workspace: '',
type: '', type: 'shared',
user: '', user: '',
environment: '', environment: 'dev',
isDeleted: '', isDeleted: '',
secretKeyCiphertext: '', secretKeyCiphertext: '',
secretKeyIV: '', secretKeyIV: '',
-6
View File
@@ -1,6 +0,0 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const secretSchema = require('./secretSchema.ts');
module.exports = {
secretSchema
}
-11
View File
@@ -1,11 +0,0 @@
const secretSchema = {
_id: {
type: 'string',
format: 'objectId'
},
version: {
type: 'number'
}
}
module.exports = secretSchema;
+32 -32
View File
@@ -2208,31 +2208,31 @@ components:
example: '' example: ''
email: email:
type: string type: string
example: '' example: [email protected]
firstName: firstName:
type: string type: string
example: '' example: John
lastName: lastName:
type: string type: string
example: '' example: Doe
publicKey: publicKey:
type: string type: string
example: '' example: johns_nacl_public_key
encryptedPrivateKey: encryptedPrivateKey:
type: string type: string
example: '' example: johns_enc_nacl_private_key
iv: iv:
type: string type: string
example: '' example: iv_of_enc_nacl_private_key
tag: tag:
type: string type: string
example: '' example: tag_of_enc_nacl_private_key
updatedAt: updatedAt:
type: string type: string
example: '' example: '2023-01-13T14:16:12.210Z'
createdAt: createdAt:
type: string type: string
example: '' example: '2023-01-13T14:16:12.210Z'
Membership: Membership:
type: object type: object
properties: properties:
@@ -2244,22 +2244,22 @@ components:
example: '' example: ''
email: email:
type: string type: string
example: '' example: [email protected]
firstName: firstName:
type: string type: string
example: '' example: John
lastName: lastName:
type: string type: string
example: '' example: Doe
publicKey: publicKey:
type: string type: string
example: '' example: johns_nacl_public_key
updatedAt: updatedAt:
type: string type: string
example: '' example: '2023-01-13T14:16:12.210Z'
createdAt: createdAt:
type: string type: string
example: '' example: '2023-01-13T14:16:12.210Z'
workspace: workspace:
type: string type: string
example: '' example: ''
@@ -2277,22 +2277,22 @@ components:
example: '' example: ''
email: email:
type: string type: string
example: '' example: [email protected]
firstName: firstName:
type: string type: string
example: '' example: John
lastName: lastName:
type: string type: string
example: '' example: Doe
publicKey: publicKey:
type: string type: string
example: '' example: johns_nacl_public_key
updatedAt: updatedAt:
type: string type: string
example: '' example: '2023-01-13T14:16:12.210Z'
createdAt: createdAt:
type: string type: string
example: '' example: '2023-01-13T14:16:12.210Z'
organization: organization:
type: string type: string
example: '' example: ''
@@ -2310,7 +2310,7 @@ components:
example: '' example: ''
name: name:
type: string type: string
example: '' example: Acme Corp.
customerId: customerId:
type: string type: string
example: '' example: ''
@@ -2348,7 +2348,7 @@ components:
properties: properties:
publicKey: publicKey:
type: string type: string
example: '' example: senders_nacl_public_key
receiver: receiver:
type: string type: string
example: '' example: ''
@@ -2466,10 +2466,10 @@ components:
example: '' example: ''
updatedAt: updatedAt:
type: string type: string
example: '' example: '2023-01-13T14:16:12.210Z'
createdAt: createdAt:
type: string type: string
example: '' example: '2023-01-13T14:16:12.210Z'
Log: Log:
type: object type: object
properties: properties:
@@ -2484,13 +2484,13 @@ components:
example: '' example: ''
email: email:
type: string type: string
example: '' example: [email protected]
firstName: firstName:
type: string type: string
example: '' example: John
lastName: lastName:
type: string type: string
example: '' example: Doe
workspace: workspace:
type: string type: string
example: '' example: ''
@@ -2533,10 +2533,10 @@ components:
example: 192.168.0.1 example: 192.168.0.1
updatedAt: updatedAt:
type: string type: string
example: '' example: '2023-01-13T14:16:12.210Z'
createdAt: createdAt:
type: string type: string
example: '' example: '2023-01-13T14:16:12.210Z'
SecretSnapshot: SecretSnapshot:
type: object type: object
properties: properties:
@@ -2571,13 +2571,13 @@ components:
example: '' example: ''
type: type:
type: string type: string
example: '' example: shared
user: user:
type: string type: string
example: '' example: ''
environment: environment:
type: string type: string
example: '' example: dev
isDeleted: isDeleted:
type: string type: string
example: '' example: ''