Skip to content

Commit

Permalink
Add intermediate schema refs to map of all refs
Browse files Browse the repository at this point in the history
Resolves #50
  • Loading branch information
aj-foster committed Jul 8, 2024
1 parent 7bbe258 commit 63e1c99
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/open_api/reader/state.ex
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ defmodule OpenAPI.Reader.State do
absolute_file = Path.join(state.current_file, relative_file)
path_segments = String.split(path_string, "/", trim: true)

{state, {:ref, {absolute_file, path_segments}}}
source_ref_full_path = {state.last_ref_file, Enum.reverse(state.last_ref_path)}
target_ref = {:ref, {absolute_file, path_segments}}

schema_specs_by_path = Map.put(state.schema_specs_by_path, source_ref_full_path, target_ref)
{%__MODULE__{state | schema_specs_by_path: schema_specs_by_path}, target_ref}
end

def with_schema_ref(state, yaml, decoder) do
Expand Down

0 comments on commit 63e1c99

Please sign in to comment.