Skip to content
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

Merged
merged 17 commits into from
Feb 17, 2025

Conversation

smondet
Copy link
Contributor

@smondet smondet commented Nov 24, 2024

No description provided.

@smondet smondet marked this pull request as draft November 24, 2024 22:01
@smondet smondet changed the title Add enum and field-mask formats (#10 and #11) Handle more parsing cases (int and str formats, additional props: fix #10, #11 and #13) Nov 25, 2024
@smondet smondet marked this pull request as ready for review November 25, 2024 14:43
@smondet smondet force-pushed the smondet-I10-enum-int-format branch from 112cc1a to 8b34166 Compare November 25, 2024 18:08
@smondet smondet force-pushed the smondet-I10-enum-int-format branch from 8b34166 to ce6759d Compare November 25, 2024 19:37
)
$ Arg.(
value (opt_all string [] (info [ "only-matching" ] ~docv:"REGEXP" ~doc:"Only output types matching REGEXP."))
)
Copy link
Collaborator

@ixzzd ixzzd Dec 27, 2024

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know whether I added enough tests :)

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))
Copy link
Collaborator

@ixzzd ixzzd Dec 27, 2024

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?

Copy link
Contributor Author

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#"
},

@smondet smondet requested a review from ixzzd February 7, 2025 15:31
@ixzzd ixzzd merged commit 7b20975 into ahrefs:master Feb 17, 2025
0 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants