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

Global validation option no longer valid with hapi 8 #2279

Closed
landau opened this issue Dec 12, 2014 · 2 comments
Closed

Global validation option no longer valid with hapi 8 #2279

landau opened this issue Dec 12, 2014 · 2 comments
Assignees
Labels
non issue Issue is not a problem or requires changes

Comments

@landau
Copy link

landau commented Dec 12, 2014

Hapi 7.5.2 supports the validation property upon creating a server. http://hapijs.com/api/7.5.2#server-options

This option appears to have been removed from Hapi 8 and now throws an error. I'm unable to find a breaking change or replacement for this option.

// Hapi 7.5.2 creation
var server = new Hapi.Server(1337, {
      validation: {
        modify: false,
        abortEarly: false,
        stripUnknown: true
      }
   });

// hapi 8 with errors
var server = new Hapi.Server( {
      validation: {
        modify: false,
        abortEarly: false,
        stripUnknown: true
      }
   });

Here is the console output

Error: Invalid server options {
  "validation" [1]: {
    "modify": false,
    "abortEarly": false,
    "stripUnknown": true
  }
}
[1] validation is not allowed

Run the hapi 8 verision in the node repl and it will instantly blow up. Please let me know if there is a proper fix for this. Thanks.

@kanongil
Copy link
Contributor

  • Reorganized all routes related configuration under a new connection routes config setting defaults.

Ie. you need to modify your connection to something like:

server.connection({
    host: HOST,
    port: PORT,
    routes: {
        validate: {
            options: {}
        }
    }
});

@landau
Copy link
Author

landau commented Dec 12, 2014

bah....I swear I searched for that and couldn't find it... Thanks!

This change should be noted under the release notes though.

@landau landau closed this as completed Dec 12, 2014
@hueniverse hueniverse added the non issue Issue is not a problem or requires changes label Dec 16, 2014
@lock lock bot locked as resolved and limited conversation to collaborators Jan 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
non issue Issue is not a problem or requires changes
Projects
None yet
Development

No branches or pull requests

3 participants