1

We have a back end that exposes 50-60 Rest APIs. These will largely be consumed by standalone applications like a Python script or a Java program.

One issue we have is the APIs are at a very granular level, they do not match the business use case. For example to perform a business use case end user might have to call 4 to 5 APIs.

I want to develop a DSL or some solution that will help provide a high level abstraction that will enable end users to implement business use cases with ease. This can either be a standalone abstraction or a "library" for Python or or some much high level programming language.

For the specific purpose of combining multiple Rest API calls to create a business use case transaction, what are the approaches available.

Thanks

4

1 回答 1

1

我认为这是个好主意。要确定您可以构建什么样的解决方案,您应该考虑不同的方面:

  • 谁会编写这些 API 组合?
  • 什么样的工具支持是合适的?我的意思是验证、语法高亮、自动完成、类型系统检查等
  • 投入多少时间才有意义?

根据这些答案,您可以考虑不同的选择。最简单的一种是使用 ANTLR 构建 DSL。你得到一个解析器,然后你构建一些程序来处理 AST 并生成代码来调用 API。您的用户只需在不受支持的文本编辑器中编辑这些程序。这样做的好处是降低了实现成本,并且您的用户可以使用简单的文本编辑器编写这些程序。

或者,您可以使用 Xtext 或 Jetbrains MPS 等语言工作台为您的语言构建一些特定的编辑器,并为您的用户提供更好的编辑体验。

于 2016-12-05T19:33:30.793 回答