schema2sheet
v2.1.0
Published
Google Sheets -> OpenAPI (OAS) generator.
Readme
sheet-schema
Google Sheets -> OpenAPI (OAS) generator.
Install
npm install
npm run buildUsage
SPREADSHEET_ID=your_sheet_id \
node dist/src/cli.js gen-oasOr install the bin locally:
npm link
sheet-schema gen-oas --spreadsheet-id your_sheet_idCreate a typed header row:
sheet-schema init-sheet --sheet users \\
--column "id*:uuid" \\
--column "email*:email" \\
--column "name:string"Env
SPREADSHEET_ID: target spreadsheet idGOOGLE_APPLICATION_CREDENTIALS: service account json path (recommended)
Options
--path-prefixdefaults to/api--exclude-prefixesdefaults to_,#--scan-rowsdefaults to10
DeveloperMetadata format
Put JSON in metadataValue, for example:
{
"ref": { "table": "users", "field": "id", "expandKey": "user" },
"description": "Owner"
}If you want to restrict metadata usage to a specific key, set --metadata-key and use the same metadataKey in Sheets.
Rules
- 1 sheet = 1 table
- First row is header
id*is required (UUID string)- Header ending with
*is NOT NULL (required in OAS) - Type priority: DeveloperMetadata > data validation enum > checkbox > format > string
Outputs
openapi.jsonschema.jsonopenapi.hash
Docs (Korean)
docs/guide.ko.md
