Skip to content

Commit b9fc150

Browse files
authored
docs(README): add diagram documenting ApiDOM stages (#4951)
1 parent 3aaeb7b commit b9fc150

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,11 +531,48 @@ If plugins are used, additional traversal is currently needed.
531531

532532
#### Generate stage
533533

534-
We can currently only generate JSON documents from the ApiDOM structure.
534+
We can generate JSON/YAML documents from the ApiDOM structure.
535535
It doesn't matter if the original document was originally defined in JSON or YAML.
536-
Generated JSON documented will have exactly the same semantic information as the original one,
536+
Generated JSON/YAML documented will have exactly the same semantic information as the original one,
537537
but the style information from the original document is not preserved (white spaces/comments, etc..).
538538

539+
```mermaid
540+
flowchart TD
541+
%% Input node
542+
In["JSON/YAML string"]
543+
544+
%%--- Parse Stage and internals
545+
subgraph Parse_Stage["Parse Stage"]
546+
P1["Lexical Analysis<br/>JSON/YAML → CST"]
547+
SA["Syntactic Analysis"]
548+
SA1["Direct<br/>*CST → Generic ApiDOM*"]
549+
SA2["Indirect<br/>*CST → JSON AST → Generic ApiDOM*"]
550+
551+
P1 --> SA
552+
SA --> SA1
553+
SA --> SA2
554+
end
555+
556+
%%--- Refract Stage
557+
subgraph Refract_Stage["Refract Stage"]
558+
R["Generic ApiDOM + plugins → Semantic ApiDOM"]
559+
end
560+
561+
%%--- Generate Stage
562+
subgraph Generate_Stage["Generate Stage"]
563+
G["Generate JSON/YAML output<br/>(style info lost)"]
564+
end
565+
566+
%% Output node
567+
Out["JSON/YAML string"]
568+
569+
%%--- Connections
570+
In --> Parse_Stage
571+
Parse_Stage --> Refract_Stage
572+
Refract_Stage --> Generate_Stage
573+
Generate_Stage --> Out
574+
```
575+
539576
---
540577

541578
Having said that, this is how JSON OpenAPI 3.1 document gets transformed into ApiDOM:

0 commit comments

Comments
 (0)