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

Remove -j-std #425

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Remove -j-std #425

wants to merge 7 commits into from

Conversation

smondet
Copy link
Contributor

@smondet smondet commented Mar 7, 2025

Cf. issue #412

PR checklist

  • New code has tests to catch future regressions
  • Documentation is up-to-date
  • CHANGES.md is up-to-date

@smondet smondet marked this pull request as ready for review March 7, 2025 15:46
@smondet
Copy link
Contributor Author

smondet commented Mar 7, 2025

 $ dune exec atdgen/bin/ag_main.exe -- --help | head -n 20
Generate OCaml code offering:         
  * OCaml type definitions translated from ATD file (-t)
  * serializers and deserializers for Biniou (-b)
  * serializers and deserializers for JSON (-j)
  * record-creating functions supporting default fields (-v)
  * user-specified data validators (-v)

Recommended usage: _build/default/atdgen/bin/ag_main.exe (-t|-b|-j|-v|-dep|-list|-mel) example.atd

Some options are deprecated. Use the environment variable `ATDGEN_FAIL_DEPRECATED_OPTIONS=true`
to make their use fail and hence help clean-up your build scripts.

  -type-conv 
    GEN1,GEN2,...
         Insert 'with GEN1, GEN2, ...' after OCaml type definitions for the
         type-conv preprocessor
    
  -deriving-conv 
    GEN1,GEN2,...
         Insert '[@@deriving GEN1,GEN2,...]' after OCaml type definitions for

@smondet
Copy link
Contributor Author

smondet commented Mar 7, 2025

Building the repo with export ATDGEN_FAIL_DEPRECATED_OPTIONS=true for now gives:

File "atdgen/test/dune", line 93, characters 0-232:
93 | (rule
94 |  (targets test_ambiguous_record_j.ml test_ambiguous_record_j.mli)
95 |  (deps    test_ambiguous_record.atd)
96 |  (action
97 |   (run %{bin:atdgen} -json -j-gen-modules -o test_ambiguous_record_j -open Test_ambiguous_record_t -ntd %{deps})))
Error: option "-json" is forbidden.
File "atdgen/test/dune", line 117, characters 0-197:
117 | (rule
118 |  (targets test_polymorphic_wrap_j.ml test_polymorphic_wrap_j.mli)
119 |  (deps    test_polymorphic_wrap.atd)
120 |  (action
121 |   (run %{bin:atdgen} -json -j-gen-modules -o test_polymorphic_wrap_j %{deps})))
Error: option "-json" is forbidden.
File "atdgen/test/dune", line 163, characters 0-139:
163 | (rule
164 |  (targets testjstd_j.ml testjstd_j.mli)
165 |  (deps    test.atd)
166 |  (action  (run %{bin:atdgen} -extend Test test.atd -json -o testjstd_j)))
Error: option "-json" is forbidden.
File "atdgen/test/dune", line 178, characters 0-128:
178 | (rule
179 |  (targets testv.ml testv.mli)
180 |  (deps    test.atd)
181 |  (action  (run %{bin:atdgen} -validate -extend Test test.atd -o testv)))
Error: option "-validate" is forbidden.
File "atdgen/test/dune", line 31, characters 0-256:
31 | (rule
32 |  (targets testj.ml testj.mli)
33 |  (deps    (:atd test.atd) test.ml test.mli)
34 |  (action
35 |   (run
36 |    %{bin:atdgen} -json -extend Test -j-custom-fields
37 |    "fun loc s -> Printf.eprintf \"Warning: skipping field %s (def: %s)\n\" s loc"
38 |    %{atd}
39 |     -o testj)))
Error: option "-json" is forbidden.

* atdgen: Remove option `-j-std`, now it's the default, one cannot generate extended-JSON (#425).
Options `-j-std` and `-std-json` are still available as backward-compatibility no-ops unless
environment variable `ATDGEN_FAIL_DEPRECATED_OPTIONS` is set to `true` in
which case their use results in an exception.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great.

Copy link
Collaborator

@mjambon mjambon left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thank you!

@smondet
Copy link
Contributor Author

smondet commented Mar 10, 2025

@mjambon should we do anything special with PRs that target the "3.0" major version (ie breaking changes we may not want in a minor release)?

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