Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Unable to parse E Notation numbers in minimum & maximum #802

Copy link
Copy link
@adminnz

Description

@adminnz
Issue body actions

When a json or yaml file has minimum or maximum values specified in E Notation
e.g.

          type: integer
          format: int64
          maximum: 9.2233720368547799E+18
          minimum: 1

When I try to import this into Azure APIM, which I believe its using this library to parse the yaml.

When I try using OpenApiStreamReader to read the yaml file, it crashes with FormatException "input string was not in a correct format".

Stack Trace:
   at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
   at System.Decimal.Parse(String s, IFormatProvider provider)
   at Microsoft.OpenApi.Readers.V3.OpenApiV3Deserializer.<>c.<.cctor>b__102_177(OpenApiSchema o, ParseNode n)
   at Microsoft.OpenApi.Readers.ParseNodes.PropertyNode.ParseField[T](T parentInstance, IDictionary`2 fixedFields, IDictionary`2 patternFields)
   at Microsoft.OpenApi.Readers.V3.OpenApiV3Deserializer.LoadSchema(ParseNode node)
   at Microsoft.OpenApi.Readers.ParseNodes.MapNode.<>c__DisplayClass6_0`1.<CreateMap>b__0(KeyValuePair`2 n)
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
   at Microsoft.OpenApi.Readers.ParseNodes.MapNode.CreateMap[T](Func`2 map)
   at Microsoft.OpenApi.Readers.V3.OpenApiV3Deserializer.<>c.<.cctor>b__102_197(OpenApiSchema o, ParseNode n)
   at Microsoft.OpenApi.Readers.ParseNodes.PropertyNode.ParseField[T](T parentInstance, IDictionary`2 fixedFields, IDictionary`2 patternFields)
   at Microsoft.OpenApi.Readers.V3.OpenApiV3Deserializer.LoadSchema(ParseNode node)
   at Microsoft.OpenApi.Readers.ParseNodes.MapNode.<>c__DisplayClass7_0`1.<CreateMapWithReference>b__0(KeyValuePair`2 n)
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
   at Microsoft.OpenApi.Readers.ParseNodes.MapNode.CreateMapWithReference[T](ReferenceType referenceType, Func`2 map)
   at Microsoft.OpenApi.Readers.V3.OpenApiV3Deserializer.<>c.<.cctor>b__102_4(OpenApiComponents o, ParseNode n)
   at Microsoft.OpenApi.Readers.ParseNodes.PropertyNode.ParseField[T](T parentInstance, IDictionary`2 fixedFields, IDictionary`2 patternFields)
   at Microsoft.OpenApi.Readers.V3.OpenApiV3Deserializer.ParseMap[T](MapNode mapNode, T domainObject, FixedFieldMap`1 fixedFieldMap, PatternFieldMap`1 patternFieldMap)
   at Microsoft.OpenApi.Readers.V3.OpenApiV3Deserializer.LoadComponents(ParseNode node)
   at Microsoft.OpenApi.Readers.V3.OpenApiV3Deserializer.<>c.<.cctor>b__102_26(OpenApiDocument o, ParseNode n)
   at Microsoft.OpenApi.Readers.ParseNodes.PropertyNode.ParseField[T](T parentInstance, IDictionary`2 fixedFields, IDictionary`2 patternFields)
   at Microsoft.OpenApi.Readers.V3.OpenApiV3Deserializer.ParseMap[T](MapNode mapNode, T domainObject, FixedFieldMap`1 fixedFieldMap, PatternFieldMap`1 patternFieldMap)
   at Microsoft.OpenApi.Readers.V3.OpenApiV3Deserializer.LoadOpenApi(RootNode rootNode)
   at Microsoft.OpenApi.Readers.V3.OpenApiV3VersionService.LoadDocument(RootNode rootNode)
   at Microsoft.OpenApi.Readers.ParsingContext.Parse(YamlDocument yamlDocument)
   at Microsoft.OpenApi.Readers.OpenApiYamlDocumentReader.Read(YamlDocument input, OpenApiDiagnostic& diagnostic)
   at Microsoft.OpenApi.Readers.OpenApiTextReaderReader.Read(TextReader input, OpenApiDiagnostic& diagnostic)
   at Microsoft.OpenApi.Readers.OpenApiStreamReader.Read(Stream input, OpenApiDiagnostic& diagnostic)

It looks like this has been "fixed" in the code as it uses NumberStyles.Float, but in the non-preview nuget release it is still broken.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.