Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

How to get a list of the current validation errors? #4820

Open
rdawson-hmrc opened this issue Mar 5, 2024 · 0 comments
Open

How to get a list of the current validation errors? #4820

rdawson-hmrc opened this issue Mar 5, 2024 · 0 comments

Comments

@rdawson-hmrc
Copy link

I have embedded the Swagger Editor in a web page and need to be able to tell from my own JavaScript code whether the document currently in the editor has any validation errors. I've tried exploring the system object that is available within plugins, something like this

const SpecUpdateListenerPlugin = function(system) {
        return {
            statePlugins: {
                spec: {
                    wrapActions: {
                        updateSpec: (oriAction) => (...args) => {
                            const [str] = args
                            console.log("ERRORS", system.errSelectors.allErrors().toJS())
                            return oriAction(...args)
                        }
                    }
                }
            }
        }
    }

but this seems unreliable, is there a better way please?

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

No branches or pull requests

1 participant