Skip to content

Commit

Permalink
Make ref type path more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
ixzzd committed Dec 28, 2023
1 parent 92f141c commit f8337c3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/generator.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ let process_int_type schema =
| _ -> failwith "int has unextected format"

let get_ref (ref : ref_) =
match String.split_on_char '/' ref with
| [ "#"; "components"; "schemas"; type_name ] -> type_name
| _ -> failwith "only OpenAPI refs is supported (#/components/schemas/)"
match ref |> String.split_on_char '/' |> List.rev with
| type_name :: _ -> type_name
| _ -> failwith (Printf.sprintf "%s: can't resolve ref type name" ref)

let rec ocaml_value_of_json = function
| (`Bool _ | `Float _ | `Int _ | `Null) as json -> Yojson.Basic.to_string json
Expand Down

0 comments on commit f8337c3

Please sign in to comment.