x-openapi-flow 1.1.0

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/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "x-openapi-flow",
3
+ "version": "1.1.0",
4
+ "description": "OpenAPI extension for resource workflow and lifecycle management",
5
+ "main": "lib/validator.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/tiago-marques/x-openapi-flow.git"
9
+ },
10
+ "homepage": "https://github.com/tiago-marques/x-openapi-flow#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/tiago-marques/x-openapi-flow/issues"
13
+ },
14
+ "files": [
15
+ "bin",
16
+ "lib",
17
+ "schema",
18
+ "examples",
19
+ "README.md",
20
+ "LICENSE"
21
+ ],
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
28
+ "bin": {
29
+ "x-openapi-flow": "bin/x-openapi-flow.js"
30
+ },
31
+ "scripts": {
32
+ "test": "npm run test:cli && npm run test:smoke",
33
+ "test:cli": "node --test tests/cli.test.js",
34
+ "test:smoke": "node bin/x-openapi-flow.js validate examples/payment-api.yaml --profile strict"
35
+ },
36
+ "keywords": [
37
+ "openapi",
38
+ "oas",
39
+ "openapi-flow",
40
+ "workflow",
41
+ "lifecycle",
42
+ "x-flow"
43
+ ],
44
+ "license": "MIT",
45
+ "dependencies": {
46
+ "ajv": "^8.17.1",
47
+ "js-yaml": "^4.1.0"
48
+ }
49
+ }
@@ -0,0 +1,68 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://x-flow.dev/schema/flow-schema.json",
4
+ "title": "x-flow",
5
+ "description": "JSON Schema for the x-flow OpenAPI extension, defining resource lifecycle states and transitions.",
6
+ "type": "object",
7
+ "required": ["version", "id", "current_state"],
8
+ "properties": {
9
+ "version": {
10
+ "type": "string",
11
+ "enum": ["1.0"],
12
+ "description": "Version of the x-flow schema contract used by this definition."
13
+ },
14
+ "id": {
15
+ "type": "string",
16
+ "description": "Unique identifier for this flow definition."
17
+ },
18
+ "current_state": {
19
+ "type": "string",
20
+ "description": "The state that the resource is in when this operation is invoked or returns."
21
+ },
22
+ "description": {
23
+ "type": "string",
24
+ "description": "Human-readable description of this flow step."
25
+ },
26
+ "idempotency": {
27
+ "type": "object",
28
+ "description": "Idempotency configuration for the operation.",
29
+ "required": ["header"],
30
+ "properties": {
31
+ "header": {
32
+ "type": "string",
33
+ "description": "HTTP header name used to carry the idempotency key."
34
+ },
35
+ "required": {
36
+ "type": "boolean",
37
+ "description": "Whether the idempotency header is mandatory."
38
+ }
39
+ },
40
+ "additionalProperties": false
41
+ },
42
+ "transitions": {
43
+ "type": "array",
44
+ "description": "List of possible state transitions from current_state.",
45
+ "items": {
46
+ "type": "object",
47
+ "required": ["target_state", "trigger_type"],
48
+ "properties": {
49
+ "target_state": {
50
+ "type": "string",
51
+ "description": "The state the resource moves to after a successful transition."
52
+ },
53
+ "condition": {
54
+ "type": "string",
55
+ "description": "Human-readable condition under which this transition occurs."
56
+ },
57
+ "trigger_type": {
58
+ "type": "string",
59
+ "enum": ["synchronous", "webhook", "polling"],
60
+ "description": "Mechanism that triggers the state transition."
61
+ }
62
+ },
63
+ "additionalProperties": false
64
+ }
65
+ }
66
+ },
67
+ "additionalProperties": false
68
+ }