Comments (3)
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.
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.
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)
- Error: Transformer is not a function HOT 3
- Suggestion: create a "class generator" for the Adonis CLI HOT 2
- Namespaced Transformers Support HOT 1
- How to access to pivot table data? HOT 5
- Some ideas for a future release HOT 9
- JSONAPI compliant serializer HOT 3
- Includes don't work for many to many relations HOT 5
- Access transform object from services HOT 2
- How to use in websocket controller HOT 1
- availableInclude not working as expected HOT 2
- A transformer must be a function or a class extending TransformerAbstract HOT 1
- How to change the status code on returning the transformed data? Like for a transform with pagination send 206 http status code.
- A transformer must be a function or a class extending TransformerAbstract HOT 6
- [Question] Accessing Manager from inside Transformer HOT 4
- Honor setHidden and setVisible HOT 2
- Is v5 planned for this package? HOT 8
- Chain Transformers with Routes
- Fail load relation on empty value fkey column when use include in transformer
- property transform does not exits in ctx
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adonis-bumblebee.