-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle more parsing cases (int and str formats, additional props: fix #10, #11 and #13) #12
base: master
Are you sure you want to change the base?
Conversation
enum
and field-mask
formats (#10 and #11)112cc1a
to
8b34166
Compare
8b34166
to
ce6759d
Compare
) | ||
$ Arg.( | ||
value (opt_all string [] (info [ "only-matching" ] ~docv:"REGEXP" ~doc:"Only output types matching REGEXP.")) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thinking this is a nice addition, thank you @smondet
Could you please add also tests for this one and mention it in the doc?
value | ||
(opt (t3 ~sep:':' keyword string string) Generator.default_state.json_ocaml_type | ||
(info [ "json-ocaml-type" ] ~docv:"KEYWORD:MODULE.PATH:TYPE-NAME" | ||
~doc:"Use an alternate Mod.type for `json`, e.g. from:My_mod.Submod:json_type." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is useful 👍
lib/generator.ml
Outdated
| None -> | ||
(* fallback to untyped if schema type is not defined *) | ||
maybe_nullable "json" | ||
Printf.ksprintf maybe_nullable "json (* %s *)" (String.concat "/" (List.rev ancestors)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about ancestors lists here, for example:
type dynamicConfigValue = {
~id <ocaml default="\"\"">: string;
- ?value : json option;
+ ?value : json (* DynamicConfigValue/value *) option;
}
https://github.com/ahrefs/jsonschema2atd/actions/runs/12166801073/job/33933871312#step:6:77
Looks like the comment is a bit redundant here. Do you have an example in mind which would illustrate the reason of having this comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've improved the comments but in that case, there is nothing in the JSON to display for "value"
:)
"DynamicConfigValue": {
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"type": "string",
"default": ""
},
"value": {}
},
"$schema": "http://json-schema.org/draft-04/schema#"
},
Co-authored-by: Egor Chemokhonenko <[email protected]>
No description provided.