Code Monkey home page Code Monkey logo

Comments (3)

rhwilr avatar rhwilr commented on May 22, 2024 2

I published version 2.1.0 that now supports snake_case include properties.

It should now work as you'd expect and your example from the initial post should work:

static get availableInclude () {
    return ['amount_used', 'administrator']
}

includeAmountUsed (coupon) {
    const {amount_used} = coupon.toJSON ()

    return amount_used
}

from adonis-bumblebee.

rhwilr avatar rhwilr commented on May 22, 2024

Hi @harlancleiton

This is currently not possible, and I don't think we can easily support this without braking existing functionality.

It might be possible to implement this with a custom Serializer.
You should be able to write a serializer that transforms all properties to snake_case before returning the response.

However, I do think we should support includes with underscores. I might take a look at it. I'd also happily accept a PR.

from adonis-bumblebee.

harlancleiton avatar harlancleiton commented on May 22, 2024

@rhwilr

I understand, I thought this note at README described this functionality

Note: If you have hyphen or underscore separated properties, you would name the include function in camelCase. The conversion is done automatically.

from adonis-bumblebee.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.