Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Option that allows you not to skip redundant intermediate classes #313

Closed
bajker-sl opened this issue Mar 21, 2022 · 4 comments
Closed

Option that allows you not to skip redundant intermediate classes #313

bajker-sl opened this issue Mar 21, 2022 · 4 comments

Comments

@bajker-sl
Copy link

bajker-sl commented Mar 21, 2022

Hi,

in the issue #225 is said that the skipping of the redundant intermediate class that has just a single collection property but not have collection semantics is a feature. Can you make it please as option and not feature?

My problem:

There is a standard XSD for some timetables. Consider the following part of it:

image

Generated class Infrastructure has Collection of ocps. Intermediate class OperationControlPoints was consider as redundant and was skipped,

Besides that there is a custom extension of this standard XSD:

image

The class for OcpCultureMappings is generated but is not reachable because OperationControlPoints is skipped. Thus, Infrastucure has collection of ocps but no OperationContolPoints...

I tried to use option --ef. It helped for root elements but in the depth the problem stays.

I suppose if it was possible to switch off the skipping feature for root elements for option --ef than it can be possible to implement it for all elements for a new general option.

Thanks in advance.

@mganss mganss closed this as completed in 732fcd2 Mar 21, 2022
@mganss
Copy link
Owner

mganss commented Mar 21, 2022

Added option --ar in 2.0.660.

@bajker-sl
Copy link
Author

Hi Michael,
unfortunerly, I don't see difference between --ar=false and --ar=true.

I expected

namespace RailML25Model.Rail
{
    ⁞
    public partial class Infrastructure : RailML25Model.Rail.TInfrastructure
    {        
        ⁞
        [System.Xml.Serialization.XmlElementAttribute("operationControlPoints")]
        public EOperationControlPoints OperationControlPoints { get; set; }
        ⁞
    }
}

but in both cases I get

namespace RailML25Model.Rail
{ 
    ⁞
    public partial class Infrastructure : RailML25Model.Rail.TInfrastructure
    {
        ⁞
        public Infrastructure()
        {
            ⁞
            this._operationControlPoints = new System.Collections.ObjectModel.Collection<EOcp>();
            ⁞
        }        
        ⁞    
        private System.Collections.ObjectModel.Collection<EOcp> _operationControlPoints;
        
        [System.Xml.Serialization.XmlArrayAttribute("operationControlPoints")]
        [System.Xml.Serialization.XmlArrayItemAttribute("ocp", Namespace="https://www.railml.org/schemas/2021")]
        public System.Collections.ObjectModel.Collection<EOcp> OperationControlPoints
        {
            get
            {
                return this._operationControlPoints;
            }
            private set
            {
                this._operationControlPoints = value;
            }
        }
        
        /// <summary>
        /// <para xml:lang="en">Gets a value indicating whether the OperationControlPoints collection is empty.</para>
        /// </summary>
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public bool OperationControlPointsSpecified
        {
            get
            {
                return (this.OperationControlPoints.Count != 0);
            }
        }
        ⁞
    }
}

@mganss
Copy link
Owner

mganss commented Mar 21, 2022

Try --ar-.

@bajker-sl
Copy link
Author

so works. Thank you very much!!! 👍 👍 👍

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants