Add .t in spec generation of Elixir structs#8159
Add .t in spec generation of Elixir structs#8159wing328 merged 6 commits intoOpenAPITools:masterfrom
Conversation
|
Hi @carrascoacd, thank you very much for your PR Sadly, the error doesn't say a lot to me :/ Have you tried |
|
Updated samples via 2ab4ceb |
|
I think that the deserialization is not right, see this It should expect the struct, not the type if I'm right. |
What does the correct code look like? |
|
Let's see this example: defmodule Pet do
@type t :: %Pet{name: String.t()}
defstruct [:name]
endiex(0)> struct(Pet.t)
** (UndefinedFunctionError) function Pet.t/0 is undefined or private
Pet.t()
iex(1)> struct(Pet)
%Pet{name: nil}It should be: |
|
I was revising this, and I think that the problem is the There is some coupling between the spec definition and the type definition somewhere. |
|
Hi @carrascoacd, sorry for my late replay. In the mean time, could you explain a little bit, what you're trying to fix with this issue? |
|
@carrascoacd since I'm only in the tech comitee I can't write to your branch, so I created a PR carrascoacd#1 After that, every thing looks good to me and hopefully @wing328 can merge this fix |
|
Ok many thanks for taking a look @mrmstn |
Adds workaround for free-form maps with propper typespec
|
@mrmstn helped me with this and we merged his changes from carrascoacd#1 into this branch. I think we are good to merge now if the pipeline passes :) @wing328 |
|
Pushed 260feb5 to fix the CircleCI failure. Will merge if all tests pass. |
Tested locally and the result is good. |

PR checklist
./bin/generate-samples.shto update all Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example./bin/generate-samples.sh bin/configs/java*. For Windows users, please run the script in Git BASH.masterI'm unable to run the
generate-samples.shdue to an error when generating the JAR file:cc/ @mrmstn