Skip to content

Declarative API development #392

Open
@patrick-tolosa

Description

@patrick-tolosa

The case for Declerative APIs

The current API of the SDK is imperative.
@yoadsn mentioned in #382 that some users would benefit from a declarative API as well.

Points of interest

  • The API should be consistent across methods (Meaning we can't pick and choose which APIs have a declarative counterpart)
  • The API should avoid using magical strings since we aim to provide the best dev experience even to people with weak IDEs.
  • We might relax the constraint above if we consider the declarative API for more advanced users, but this needs to be explored before deciding.

Trivial example

Imperative

new Image().resize(scale().width(100).height(100)) 

Declerative

new Image().resize(scale({
  width: 100,
  height: 100
}))

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions