neon icon indicating copy to clipboard operation
neon copied to clipboard

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

Open pippijn opened this issue 1 year ago • 3 comments

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

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

pippijn avatar Oct 26 '24 21:10 pippijn

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.

provokateurin avatar Oct 27 '24 14:10 provokateurin

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

pippijn avatar Oct 28 '24 15:10 pippijn

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.

provokateurin avatar Oct 28 '24 15:10 provokateurin