@swagger-api/apidom-parser-adapter-yaml-1-2 1.0.0-rc.3 → 1.0.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/CHANGELOG.md +8 -0
- package/README.md +9 -9
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.0.0](https://github.com/swagger-api/apidom/compare/v1.0.0-rc.4...v1.0.0) (2025-12-03)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @swagger-api/apidom-parser-adapter-yaml-1-2
|
|
9
|
+
|
|
10
|
+
# [1.0.0-rc.4](https://github.com/swagger-api/apidom/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2025-11-25)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @swagger-api/apidom-parser-adapter-yaml-1-2
|
|
13
|
+
|
|
6
14
|
# [1.0.0-rc.3](https://github.com/swagger-api/apidom/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2025-11-07)
|
|
7
15
|
|
|
8
16
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
`@swagger-api/apidom-parser-adapter-yaml-1-2` is a parser adapter for the [YAML 1.2 format](https://yaml.org/spec/1.2/spec.html).
|
|
4
4
|
|
|
5
|
-
[CST](https://tree-sitter.github.io/tree-sitter/using-parsers#syntax-nodes) produced by lexical analysis is [syntactically analyzed](https://github.com/swagger-api/apidom/blob/main/packages/apidom-parser-adapter-yaml-1-2/src/syntactic-analysis) and
|
|
6
|
-
ApiDOM structure using [base ApiDOM namespace](https://github.com/swagger-api/apidom/tree/main/packages/apidom#base-namespace) is produced.
|
|
5
|
+
[CST](https://tree-sitter.github.io/tree-sitter/using-parsers/2-basic-parsing.html#syntax-nodes) produced by lexical analysis is [syntactically analyzed](https://github.com/swagger-api/apidom/blob/main/packages/apidom-parser-adapter-yaml-1-2/src/syntactic-analysis) and
|
|
6
|
+
ApiDOM structure using [base ApiDOM namespace](https://github.com/swagger-api/apidom/tree/main/packages/apidom-core#base-namespace) is produced.
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
@@ -16,7 +16,7 @@ via [npm CLI](https://docs.npmjs.com/cli) by running the following command:
|
|
|
16
16
|
|
|
17
17
|
## Parse phases
|
|
18
18
|
|
|
19
|
-
The parse stage takes YAML string and produces ApiDOM structure using [base ApiDOM namespace](https://github.com/swagger-api/apidom/tree/main/packages/apidom#base-namespace).
|
|
19
|
+
The parse stage takes YAML string and produces ApiDOM structure using [base ApiDOM namespace](https://github.com/swagger-api/apidom/tree/main/packages/apidom-core#base-namespace).
|
|
20
20
|
There are two phases of parsing: **Lexical Analysis** and **Syntactic Analysis**.
|
|
21
21
|
|
|
22
22
|
### Lexical Analysis
|
|
@@ -27,8 +27,8 @@ Lexical Analysis will take a YAML string and turn it into a stream of tokens.
|
|
|
27
27
|
### Syntactic Analysis
|
|
28
28
|
|
|
29
29
|
Syntactic Analysis will take a stream of tokens and turn it into an ApiDOM representation.
|
|
30
|
-
[CST](https://tree-sitter.github.io/tree-sitter/using-parsers#syntax-nodes) produced by lexical analysis is [syntactically analyzed](https://github.com/swagger-api/apidom/blob/main/packages/apidom-parser-adapter-yaml-1-2/src/syntactic-analysis)
|
|
31
|
-
and ApiDOM structure using [base ApiDOM namespace](https://github.com/swagger-api/apidom/tree/main/packages/apidom#base-namespace) is produced.
|
|
30
|
+
[CST](https://tree-sitter.github.io/tree-sitter/using-parsers/2-basic-parsing.html#syntax-nodes) produced by lexical analysis is [syntactically analyzed](https://github.com/swagger-api/apidom/blob/main/packages/apidom-parser-adapter-yaml-1-2/src/syntactic-analysis)
|
|
31
|
+
and ApiDOM structure using [base ApiDOM namespace](https://github.com/swagger-api/apidom/tree/main/packages/apidom-core#base-namespace) is produced.
|
|
32
32
|
|
|
33
33
|
## Parser adapter API
|
|
34
34
|
|
|
@@ -45,13 +45,11 @@ Defines list of media types that this parser adapter recognizes.
|
|
|
45
45
|
|
|
46
46
|
### detect
|
|
47
47
|
|
|
48
|
-
[Detection](https://github.com/swagger-api/apidom/blob/main/packages/apidom-parser-adapter-yaml-1-2/src/adapter.ts#
|
|
49
|
-
always returns `false`. The reason is that it's almost impossible to detect if a source string is YAML without actually parsing it.
|
|
50
|
-
Don't rely on this function, rather use `mediaType` instead and please read [Word on detect vs mediaTypes](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser#word-on-detect-vs-mediatypes).
|
|
48
|
+
[Detection](https://github.com/swagger-api/apidom/blob/main/packages/apidom-parser-adapter-yaml-1-2/src/adapter-node.ts#L14) of this parser adapter uses [lexical analysis](#lexical-analysis) to indicate whether the provided source string is YAML.
|
|
51
49
|
|
|
52
50
|
### namespace
|
|
53
51
|
|
|
54
|
-
This adapter exposes an instance of [base ApiDOM namespace](https://github.com/swagger-api/apidom/tree/main/packages/apidom#base-namespace).
|
|
52
|
+
This adapter exposes an instance of [base ApiDOM namespace](https://github.com/swagger-api/apidom/tree/main/packages/apidom-core#base-namespace).
|
|
55
53
|
|
|
56
54
|
### parse
|
|
57
55
|
|
|
@@ -85,6 +83,8 @@ const parseResult = await parse('prop: value', { sourceMap: true });
|
|
|
85
83
|
|
|
86
84
|
### Indirect usage
|
|
87
85
|
|
|
86
|
+
You can omit the `mediaType` option here, but please read [Word on detect vs mediaTypes](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser#word-on-detect-vs-mediatypes) before you do so.
|
|
87
|
+
|
|
88
88
|
```js
|
|
89
89
|
import ApiDOMParser from '@swagger-api/apidom-parser';
|
|
90
90
|
import * as yamlParserAdapter from '@swagger-api/apidom-parser-adapter-yaml-1-2';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swagger-api/apidom-parser-adapter-yaml-1-2",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Parser adapter for parsing YAML documents into base namespace.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"license": "Apache-2.0",
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@babel/runtime-corejs3": "^7.26.10",
|
|
53
|
-
"@swagger-api/apidom-ast": "^1.0.0
|
|
54
|
-
"@swagger-api/apidom-core": "^1.0.0
|
|
55
|
-
"@swagger-api/apidom-error": "^1.0.0
|
|
53
|
+
"@swagger-api/apidom-ast": "^1.0.0",
|
|
54
|
+
"@swagger-api/apidom-core": "^1.0.0",
|
|
55
|
+
"@swagger-api/apidom-error": "^1.0.0",
|
|
56
56
|
"@tree-sitter-grammars/tree-sitter-yaml": "=0.7.1",
|
|
57
57
|
"@types/ramda": "~0.30.0",
|
|
58
58
|
"ramda": "~0.30.0",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"README.md",
|
|
75
75
|
"CHANGELOG.md"
|
|
76
76
|
],
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "d3037a5767f23a90d3b32da1777751a27e3a815f"
|
|
78
78
|
}
|