Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Foxx model schema with nested objects

Tags:

joi

arangodb

foxx

All the examples I've found for Foxx.Model schemas are flat - i.e. they don't include nested objects.

I'm trying to add a hash to save geo info on a model like this:

var Foo = Foxx.Model.extend({
    schema: {
      name: joi.string().required(),
      location: joi.object().keys({
        lat: joi.number(),
        lng: joi.number()
      })
    }
});

This shows up in the Foxx interface Data Type as this:

foo {
    name (string),
    location (object, optional)
}

How do I get it to show the key names 'lat' and 'lng' for the location object?

Or am I thinking about this incorrectly?


1 Answers

You are using it correctly and it will work and check your object correctly. This is just a limitation of the documentation tool used in the admin interface of ArangoDB.

like image 115
moonglum Avatar answered Sep 03 '26 17:09

moonglum



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!