Skip to content

Conversation

@ndbroadbent
Copy link

@ndbroadbent ndbroadbent commented Apr 13, 2020

Fixes #292

If a schema has type: ["string", "null"] or type: ["null", "integer"], etc., this change will just use the first non-null type from the array.

UPDATE: I just found some other cases where this needs to be handled: I wasn't able to update the value for any optional drop-down select lists (ListField). There might be a few other places with lines of code similar to this:

            if (!self.schema.type || self.schema.type === "string")

These will need to be updated to something like:

            if (!self.schema.type || self.schema.type === "string" || (
                Alpaca.isArray(self.schema.type) && 
                self.schema.type.length === 2 && 
                self.schema.type.indexOf("string") !== -1 && 
                self.schema.type.indexOf("null") !== -1))
            {

(But probably less verbose!)

Maybe there could be a generic "schema type checker" function that checks for any | null.

@renannprado
Copy link

Just came across alpaca for the first time and I face exactly this situation at the moment. It would be really nice if this fix is merged :D

@evaisse
Copy link

evaisse commented May 20, 2020

Hye, I've the same problems, could you merge this branch ?

ndbroadbent added a commit to DocSpring/alpaca that referenced this pull request Jan 22, 2026
Added comprehensive documentation of:
- Open PRs gitana#746 and gitana#747 from 2020 that contain DocSpring fixes
- Related issues gitana#570, gitana#745, gitana#748, gitana#749 that affect the codebase
- Clarified which commits are DocSpring-specific vs general improvements
- Linked issues to specific DocSpring commits where applicable

This provides complete context for future maintenance and upstream updates.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

JSON Schema type: ['integer','null'] not supported

3 participants