Skip to content

Conversation

@pafuent
Copy link

@pafuent pafuent commented Dec 29, 2025

The code assumed that anyOf and oneOf arrays always contain schemas with $ref properties.
Schemas like this one...

  "anyOf": [
    {
      "required": ["cloud", "suite"],
      "additionalProperties": true
    },
    {
      "required": ["cloud", "tags"],
      "additionalProperties": true
    }
  ]

...caused this error: "runtime error: invalid memory address or nil pointer dereference"
To fix it I added nil checks.

Also if a Link title used parentheses the generated Go code was invalid.
To fix it I added parentheses to the regex used to split Link titles.

I also add it go.mod

Here is a schema file that could be used to reproduce the original issues.

…h parentheses

The code assumed that anyOf and oneOf arrays always contain schemas with $ref properties.
Schemas like this one...
```json
  "anyOf": [
    {
      "required": ["cloud", "suite"],
      "additionalProperties": true
    },
    {
      "required": ["cloud", "tags"],
      "additionalProperties": true
    }
  ]
```
...caused this error: "runtime error: invalid memory address or nil pointer dereference"
To fix it I added nil checks
Also if a Link title used parentheses the generated Go code was invalid.
To fix it I added parentheses to the regex used to split Link titles.
I also add it go.mod
Copy link

@nickrisaro nickrisaro left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks 💜

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