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

Snakeyaml generators needs some changes for Snakeyaml 2.x #367

Open
mykelalvis opened this issue Sep 10, 2023 · 1 comment
Open

Snakeyaml generators needs some changes for Snakeyaml 2.x #367

mykelalvis opened this issue Sep 10, 2023 · 1 comment
Labels

Comments

@mykelalvis
Copy link
Contributor

I use modello fairly often. But ffor years, I have never successfully gotten the snakeyaml-* plugins to work for me. I've tried several times with several versions of the plugin and the parser library, so I thought I'd give it a try modello-2.x.

The plugin produces generated code [for me] that won't compile with any 2.0+ version of snakeyaml. I ran an integration test build on a checkout of modello-2.1.2, and there appear to be no generated test executions for snakeyaml. Without such test executions, it seems reasonable that API changes would get missed.

Numerous issues exist within my generated code, such as

  • Snakeyaml's Parser constructor (in ParserImpl) requires a LoaderOptions object to use a Reader. Other options were @Deprecated at least as of snakeyaml-1.33. Adding a default new LoaderOptions() there would probably solve this.
  • SequenceStartEvent's constructor does not have the signatures used by the generated files. In 2.x, the SequenceStartEvent has a constructor whose last argument is a DumperOptions.FlowStyle, not a boolean. Also deprecated in 1.33.
    PROBABLY should be FlowStyle.BLOCK.
  • Java5-based Map models (which gen as <String,String>) are processed as <String,Object> which cannot be compiled due to mistyping
    • The plugin generates this line for the Map
      for ( java.util.Map.Entry<String, String> entry : generatedProcessExecution.getExy().entrySet() )
      where .getExy() returns a Map which is <String,Object>
      which the compiler (correctly) reports as
      cannot convert from element type Map.Entry<Object,String> to Map.Entry<String,String>

The relevant <field> in my model for exy (above) is

        <field>
          <name>exy</name>
          <description>Extra vocabulary as key/value.</description>
          <version>1.0.0+</version>
          <identifier>true</identifier>
          <type>Map</type>
          <association xml.mapStyle="inline">
            <type>String</type>
            <multiplicity>*</multiplicity>
          </association>
        </field>

If I fall back to snakeyaml-1.33, then the only failure is the <String,Object> relative to the Map field. Even if that weren't the case, this would not be parity with modello-2.1.2's listed dependencies.

If I'm configuring something incorrectly that's triggering some of this, I'd love to hear what that is.

Attaching my model for reference.

@olamy olamy changed the title Snakeyaml generators appear not to work. Snakeyaml generators needs some changes for Snakeyaml 2.x Sep 10, 2023
@olamy
Copy link
Member

olamy commented Sep 10, 2023

sounds like non compatible changes in snakeyaml 2.x

cstamas added a commit that referenced this issue Feb 17, 2024
But they do not work. Hopefully someone picks it up.

Basically following comments should not have been accepted:
198388f
998c45c
6cf6da8

As Snakeyaml 1.x to 2.x migration is not simple and currently
this modello plugin is busted: it generates uncompilable
code (sue Snakeyaml breaking changes).
@slachiewicz slachiewicz added the bug label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants