question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to create an adapter dynamically

See original GitHub issue

There are a lot of cases where users are not able to use laconia’s built-in adapters. For example when creating an API endpoint, users are unable to create PUT or PATCH endpoint with the built-in adapters as we only support the inputType of body or params at the moment i.e. PUT might require body and params.

The current adapter for params is also forcing an object to be passed as an input, and sometimes destructuring just a single parameter feels quite unnatural. For example if a user is trying to get id path parameter, it will look like:

const app = ({ id }) => {}

Sometimes I’d like to have complete control over the signature of my app, and if I would like my signature like the following, I won’t be able to use the current built-in adapter:

const app = (id) => {}

In Java world, this can be solved by using annotation, which may look like the following.

const app = (@PathVariable('id') id, @Body automaticallyParsedHttpBody, @PathVariable('foo') foo) => {}

As this is unsupported in JavaScript, how can we allow users to do this? Thoughts?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
ceilforscommented, Jun 25, 2020

@all-contributors please add @hugosenari for design

1reaction
hugosenaricommented, Jun 17, 2020
const apigateway = adapterApi.apigateway({
  mapping: (parsedRequest) => [parsedRequest.params.id, parsedRequest.body]
);

Looks good to me, only problem is with ‘mapping’, term is to broad.

Roots:

  • event
  • input
  • subject

Suffixes:

  • mapping
  • transformer
  • adapter
  • functor
  • factory
  • interpreter
  • mediator

IE.:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create dynamic lists with RecyclerView - Android Developers
The Adapter creates ViewHolder objects as needed and also sets the data for those views. The process of associating views to their data...
Read more >
android - Adding components dynamically to RecyclerView
I'd like to add views to the llDay dynamically. Here is my Adapter: public class DiaryAdapter extends RecyclerView.Adapter<RecyclerView.
Read more >
Configuring a virtual Ethernet adapter - HMC - IBM
You can configure a virtual Ethernet adapter dynamically for a running logical partition by using the Hardware Management Console (HMC).
Read more >
Using the RecyclerView | CodePath Android Cliffnotes
Every adapter has three primary methods: onCreateViewHolder to inflate the item layout and create the holder, onBindViewHolder to set the view attributes based ......
Read more >
3. Add Rows to ListView Dynamically - YouTube
Learn how to dynamically add rows to your ListView in your Android app.Grocery ListView App Playlist: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found