-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: YAML 1.2 * docs(js): syntax error * test: rename case
- Loading branch information
Showing
5 changed files
with
63 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
%YAML 1.2 | ||
--- | ||
openapi: 3.0.0 | ||
info: | ||
title: Random title | ||
description: Random description | ||
version: 0.0.1 | ||
contact: | ||
email: random@random.com | ||
paths: {} | ||
servers: | ||
- url: https://www.random.com | ||
components: | ||
schemas: | ||
RandomRequest: | ||
description: A random request | ||
type: object | ||
properties: | ||
implicit_string_date: | ||
description: Some YAML 1.2 implicit string. | ||
type: string | ||
example: 2012-10-12 | ||
another_implicit_string_date: | ||
description: Some string. | ||
type: string | ||
example: x20121012 | ||
explicit_string_date: | ||
description: Explicit string. | ||
type: string | ||
example: "2012-10-12" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as path from '@stoplight/path'; | ||
import { parseWithPointers } from '@stoplight/yaml'; | ||
import * as fs from 'fs'; | ||
|
||
const implicitStringOAS3Document = path.join(__dirname, './__fixtures__/implicit-strings.oas3.yaml'); | ||
|
||
describe('Parsing', () => { | ||
it('parses YAML scalar values according to YAML 1.2', () => { | ||
const { data } = parseWithPointers(fs.readFileSync(implicitStringOAS3Document, 'utf8')); | ||
|
||
expect(data).toHaveProperty( | ||
'components.schemas.RandomRequest.properties.implicit_string_date.example', | ||
'2012-10-12', | ||
); | ||
expect(data).toHaveProperty( | ||
'components.schemas.RandomRequest.properties.another_implicit_string_date.example', | ||
'x20121012', | ||
); | ||
expect(data).toHaveProperty( | ||
'components.schemas.RandomRequest.properties.explicit_string_date.example', | ||
'2012-10-12', | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters