Code Monkey home page Code Monkey logo

Comments (9)

jeroenvandergeer avatar jeroenvandergeer commented on May 23, 2024 1

I will look into that and create a seperate issue / PR for it.

I still feel like this option has it's use cases so I'll leave the branch for now.

from xsd2php.

jeroenvandergeer avatar jeroenvandergeer commented on May 23, 2024 1

It's not really the same thing, but it solves the same problem for me. I think this can be closed.

from xsd2php.

goetas avatar goetas commented on May 23, 2024

What about skipWhenEmpty in https://github.com/schmittjoh/serializer/blob/master/src/JMS/Serializer/Annotation/XmlCollection.php#L41 ?

from xsd2php.

jeroenvandergeer avatar jeroenvandergeer commented on May 23, 2024

I guess that's an option, but this would mean I have to edit all of the generated metadata. And it would still never use the available ElementListAType, even though that code was generated.

Do you know if it's possible to make not skipping empty lists the default in the serializer?

from xsd2php.

goetas avatar goetas commented on May 23, 2024

I guess that's an option, but this would mean I have to edit all of the generated metadata.

metadata are meant be be overwritten each time. are you editing them manually?

And it would still never use the available ElementListAType, even though that code was generated.

isn't the only the propose of this element to have tue list element present in the serialized XML? if you manage to do it via skipWhenEmpty = false, everything should work fine, is it?

Do you know if it's possible to make not skipping empty lists the default in the serializer?

not possible for now

from xsd2php.

jeroenvandergeer avatar jeroenvandergeer commented on May 23, 2024

I'm not editing the metadata, that's actually exactly what I'm trying to avoid.
How can I apply skipWhenEmpty to the property without editing the metadata?

And yes, currently the only purpose of the element is to have it present in the serialized XML. That, and it feels like it makes "sense" in some cases to use the element instead of a plain array.

from xsd2php.

jeroenvandergeer avatar jeroenvandergeer commented on May 23, 2024

Actually, I realise that since the ElementList has a implicit minOccurs of 1 it makes more sense to have the generator add the skip_when_empty: false to any list that should occur at least once.

Maybe it's better to focus on that.

from xsd2php.

goetas avatar goetas commented on May 23, 2024

yes!

from xsd2php.

goetas avatar goetas commented on May 23, 2024

@jeroenvandergeer is this solved by #27 ?

from xsd2php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.