nextcloud / neon

A framework for building convergent cross-platform Nextcloud clients using Flutter.
Other
129 stars 31 forks source link

Dynamite: `"parameters"` don't support `"$ref"` in openapi specs #2590

Open pippijn opened 3 weeks ago

pippijn commented 3 weeks ago

How to use GitHub


Steps to reproduce

  1. Create an something.openapi.json file with an operation using a "parameters" with a reference in it.
  2. dart run build_runner build

Expected behaviour

It should behave the same as if the $ref had been inlined.

Actual behaviour

Deserializing to 'OpenAPI' failed due to: Deserializing to 'BuiltMap<String, PathItem>' failed due to: Deserializing to 'PathItem' failed due to: Deserializing to 'Operation' failed due to: Deserializing to 'BuiltList<Parameter>' failed due to: Deserializing to 'Parameter' failed due to: Null check operator used on a null value
package:built_value/src/built_json_serializers.dart 180:11  BuiltJsonSerializers._deserialize
package:built_value/src/built_json_serializers.dart 125:18  BuiltJsonSerializers.deserialize
package:built_value/src/built_json_serializers.dart 42:12   BuiltJsonSerializers.deserializeWith
package:dynamite/src/builder/state.dart 26:57               State.spec
package:dynamite/src/builder/state.dart                     State.spec
package:dynamite/src/openapi_builder.dart 55:43             OpenAPIBuilder.build
provokateurin commented 2 weeks ago

Thanks for reporting, I will look into it soon. Can you maybe post a minimal spec that produces this error? Then it is a bit easier for me to confirm and fix it.

pippijn commented 2 weeks ago

I haven't tested the not-working one for correctness, but I think it's correct. I'll check in a few hours.

provokateurin commented 2 weeks ago

Ah yes, the problem is that we don't resolve and refs that don't point to #/components/schemas/*. I initially thought you meant a $ref inside the schema of a parameter.