본문으로 건너뛰기

API Reference

Core layer (@powerduck/workspace-yaml/core)​

FunctionDescription
createWorkspaceYaml(options?)Generate a workspace.yaml content string
createOpenApiYaml(options)Generate an OpenAPI 3.2 YAML content string
createWorkspaceWithApi(options)Generate both workspace and OpenAPI content
parseWorkspaceYaml(content)Parse and validate a workspace.yaml string

createOpenApiYaml(options) options​

OptionTypeRequiredDescription
titlestringYesAPI title
versionstringNoDefault "1.0.0"
descriptionstringNoAPI description
contact{ name?, url?, email? }NoContact info
license{ name, url? }NoLicense info
serversArray<{ url, description? }>NoServer list

File layer (@powerduck/workspace-yaml)​

FunctionDescription
initializeWorkspace(options)Create a workspace.yaml file on disk
initializeOpenApi(options)Create an OpenAPI YAML file on disk
createWorkspaceApi(options)Create both files atomically (rollback on failure)

createWorkspaceApi(options) options​

OptionTypeRequiredDescription
workspaceDirectorystringYesTarget directory
oasIdstringYesUnique API identifier
namestringYesDisplay name
filestringNoRelative path (default: oasFiles/${oasId}.openapi.yaml)
titlestringNoAPI title (defaults to name)
versionstringNoAPI version (default: "1.0.0")
overwriteOpenApibooleanNoDefault false

Errors​

All errors are instances of WorkspaceYamlError with a machine-readable code:

CodeDescription
INVALID_ARGUMENTInvalid input parameter
ALREADY_EXISTSFile already exists (and overwrite is false)
NOT_FOUNDFile not found
IO_ERRORFilesystem operation failed
INVALID_WORKSPACEInvalid workspace configuration
INVALID_OPENAPIInvalid OpenAPI document
ROLLBACK_FAILEDTransaction rollback failed