question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Azure.Anaytics.Synapse.Artifacts] Deserialization exception from CodeModel.yaml

See original GitHub issue

@annelo-msft commented on Thu Aug 05 2021

I am trying to generate code for the Azure.Anaytics.Synapse.Artifacts from an updated autorest.md file pointing to the service team’s new preview swagger:

(i.e. this API Spec with the tag package-artifacts-2021-06-01-preview)

I am getting the following exception:

YamlDotNet.Core.YamlException: ‘(Line: 51548, Col: 11, Idx: 3358409) - (Line: 51548, Col: 11, Idx: 3358409): Exception during deserialization’

YamlDotNet.Core.YamlException HResult=0x80131500 Message=(Line: 51548, Col: 11, Idx: 3358409) - (Line: 51548, Col: 11, Idx: 3358409): Exception during deserialization Source=YamlDotNet StackTrace: at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer) at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer) at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.<>c__DisplayClass3_0.<DeserializeValue>b__0(IParser r, Type t) at YamlDotNet.Serialization.NodeDeserializers.ObjectNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func3 nestedObjectDeserializer, Object& value) at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer) at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer) at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.<>c__DisplayClass3_0.<DeserializeValue>b__0(IParser r, Type t) at YamlDotNet.Serialization.NodeDeserializers.ObjectNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func3 nestedObjectDeserializer, Object& value) at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer) at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer) at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.<>c__DisplayClass3_0.<DeserializeValue>b__0(IParser r, Type t) at YamlDotNet.Serialization.NodeDeserializers.CollectionNodeDeserializer.DeserializeHelper(Type tItem, IParser parser, Func3 nestedObjectDeserializer, IList result, Boolean canUpdate) at YamlDotNet.Serialization.NodeDeserializers.CollectionNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func3 nestedObjectDeserializer, Object& value) at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer) at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer) at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.<>c__DisplayClass3_0.<DeserializeValue>b__0(IParser r, Type t) at YamlDotNet.Serialization.NodeDeserializers.ObjectNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func3 nestedObjectDeserializer, Object& value) at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer) at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer) at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.<>c__DisplayClass3_0.<DeserializeValue>b__0(IParser r, Type t) at YamlDotNet.Serialization.NodeDeserializers.ObjectNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func3 nestedObjectDeserializer, Object& value) at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer) at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer) at YamlDotNet.Serialization.Deserializer.Deserialize(IParser parser, Type type) at YamlDotNet.Serialization.Deserializer.Deserialize[T](IParser parser) at YamlDotNet.Serialization.Deserializer.Deserialize[T](TextReader input) at YamlDotNet.Serialization.Deserializer.Deserialize[T](String input) at AutoRest.CSharp.Input.CodeModelSerialization.DeserializeCodeModel(String yaml) in C:\src\autorest.csharp\src\AutoRest.CSharp\Common\Input\CodeModelSerialization.cs:line 52

This exception was originally thrown at this call stack: System.Convert.ChangeType(object, System.Type, System.IFormatProvider) YamlDotNet.Serialization.Utilities.TypeConverter.ChangeType(object, System.Type, System.Globalization.CultureInfo) YamlDotNet.Serialization.Utilities.TypeConverter.ChangeType(object, System.Type) YamlDotNet.Serialization.NodeDeserializers.CollectionNodeDeserializer.DeserializeHelper(System.Type, YamlDotNet.Core.IParser, System.Func<YamlDotNet.Core.IParser, System.Type, object>, System.Collections.IList, bool) YamlDotNet.Serialization.NodeDeserializers.CollectionNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(YamlDotNet.Core.IParser, System.Type, System.Func<YamlDotNet.Core.IParser, System.Type, object>, out object) YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(YamlDotNet.Core.IParser, System.Type, YamlDotNet.Serialization.Utilities.SerializerState, YamlDotNet.Serialization.IValueDeserializer)

Inner Exception 1: InvalidCastException: Object must implement IConvertible.

Files: CodeModelAndConfiguration.zip

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
timotheeguerincommented, Sep 11, 2021

Yeah I can easily repro with this simple spec with an allOf that is a string

openapi: 3.0.1
info:
  title: test
  version: 0.0.1
  description: ""
paths:
  /test:
    post:
      operationId: some_api
      parameters: []
      responses:
        default:
          description: Test
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Foo
components:
  schemas:
    Foo:
      description: Foo
      type: object
      allOf:
        - $ref: "#/components/schemas/Bar"
      properties:
        projectId:
          type: string
    Bar:
      type: string

Will see what validation I can add here.

For your use case though why did you change the type? Is this necessary?

1reaction
timotheeguerincommented, Sep 10, 2021

So this seems to be due to this directive:

directive:
  from: swagger-document
  where: $.definitions.DatasetCompression
  transform: $.type = "string"

which change the type of DatasetCompression to string and I guess some other schema have allOf reference to it which cause issue as it can’t be extending a string.

Now I a not sure why modelerfour doesn’t complain before about that, will look into it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure.Analytics.Synapse.Artifacts.Models Namespace
This activity will fail within its own scope and output a custom error message and error code. The error message and code can...
Read more >
USE flag index - Gentoo Linux
Build support for C++ (bindings, extra libraries, code generation, ...) dbi, Enable dev-db/libdbi (database-independent abstraction layer) support.
Read more >
Compare Packages Between Distributions - DistroWatch.com
Complete summaries of the Baruwa Enterprise Edition and openSUSE projects are available. Note: In case where multiple versions of a package are shipped...
Read more >
use.local.desc - (at) dei.uc.pt.
CodeArtifact: Secure and scalable artifact management service for software ... X-Ray : Provides request tracing, exception collection, and profiling ...
Read more >
Simple index
... avocado-framework-plugin-varianter-pict avocado-framework-plugin-varianter-yaml-to-mux ... azure-synapse-artifacts azure-synapse-managedprivateendpoints ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found