Re: yaml-cpp and YAML 1.2
Andrey Somov <[email protected]> Thu, 3 Mar 2016 22:16:25 +0100
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <CALbkv0caTSZbKPRT9KpdOUjqh+nAtvCY0Dzy+w2y_20GQz1sQg@mail.gmail.com> |
YAML:Node should be parsed differently for the same document:
{ a: true, b: 0x55 }
Failsafe Schema => a and b are strings
JSON Schema => a is boolean, b is string
Core Schema => a is boolean, b is integer
SnakeYAML implements (almost) everything except schemas.
That is why SnakeYAML says it only supports YAML 1.1
If we do not have to respect schemas than many more parsers may become YAML
1.2 compliant.
JS-YAML does support schemas in its API.
Cheers,
Andrey
On Thu, Mar 3, 2016 at 9:11 PM, Jesse Beder <[email protected]> wrote:
> The examples are here:
>
> https://github.com/jbeder/yaml-cpp/blob/master/test/specexamples.h
>
> and the tests are here:
>
>
> https://github.com/jbeder/yaml-cpp/blob/master/test/integration/handler_spec_test.cpp
>
> https://github.com/jbeder/yaml-cpp/blob/master/test/integration/node_spec_test.cpp
>
> As for parsing with schemas: what does it mean to parse with the JSON
> schema in C++? If I write
>
> X parsed = parseWithJsonSchema(...)
>
> what is the type of X? In yaml-cpp, the result of parsing is always
> YAML::Node, which then can be turned into any type you like statically.
>
> On Thu, Mar 3, 2016 at 9:48 AM, Andrey Somov <[email protected]>
> wrote:
>
>> Dear Jesse,
>> I looked in the source but I could not find the tests which take all the
>> examples form the specifications (as libyaml, PyYAML and SnakeYAML do).
>> Do you try to parse all the examples from the specification ?
>>
>> Cheers,
>> Andrey
>>
>>
>>
>>
>> On Wed, Mar 2, 2016 at 6:26 PM, Andrey Somov <[email protected]>
>> wrote:
>>
>>>
>>>
>>> >Happy to answer any questions.
>>>
>>> >Because C++ is statically typed and has no initial class, I always
>>> viewed schema >as an application task. yaml-cpp lets you deserialize to any
>>> application-specific >type, but you have to ask statically, so automatic
>>> resolution seems less useful.
>>>
>>> Dear Jesse,
>>> I did not quite catch you. Java is also statically typed, but it is
>>> unrelated to Recommended Schemas.
>>> The YAML 1.2 spec requires that the user may select (as an option) to
>>> parse the very same document with different schemas. JS-yaml does have
>>> support for that (partially).
>>>
>>> If I want to apply JSON schema and use yaml-cpp what should I do ?
>>>
>>>
>>> (other questions follow :-)
>>> Cheers,
>>> Andrey
>>>
>>>
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>> Monitor end-to-end web transactions and take corrective actions now
>> Troubleshoot faster and improve end-user experience. Signup Now!
>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>> _______________________________________________
>> Yaml-core mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/yaml-core
>>
>>
>
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Yaml-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/yaml-core