moov-io / rtp20022

ISO20022 messages in Go for Real Time Payments (RTP)
Apache License 2.0
55 stars 10 forks source link

fix: correct typo in the validate template for length restrictions #56

Closed devzaidi closed 7 months ago

devzaidi commented 7 months ago

Fixes a typo that causes code generation to fail when a length restriction is present in a schema file. Note that this bug was found when attempting to use the project to generate code for a different specification where a length restriction is specified like so:

<xs:restriction base="xs:string">
      <xs:length value="65"/>

To reproduce this, one may paste the lines above into an existing schema file and then attempt to do

make generate

which ultimately fails with this error:

Could not execute template: template: internal/templates/rtp20022/validate.tgo:140:59: executing "internal/templates/rtp20022/validate.tgo" at <.Restriction.MinLength.Value>: nil pointer evaluating *xsd.MinLength.Value
adamdecaf commented 7 months ago

Thank you for the fix!

adamdecaf commented 7 months ago

I've cut a release with this fix included - https://github.com/moov-io/rtp20022/releases/tag/v0.10.2