API 设计 & 开发 新范式

设计 优先, 体验高度 语言化 模块化 可视化 新API之旅
一体化 分发 监控 管理 您的API资产

syntax = "proto3";

service OrderService {
  option (hope.swagger.svc) =
    { path: "/order"; description: "Order Service"; }

  rpc Place (PlaceOrderRequest)
    returns (OrderPlacedResponse) {
    option (hope.swagger.operation) = {
      get: "/place";
      description: "place a new order";
    };
  }

  rpc Query (QueryOrderRequest)
    returns (OrderView) {
    option (hope.swagger.operation) = {
      get: "/query";
      pageable: true;
      description: "query all live order";
    };
  }
}

IDEA 完整语言支持

智能的自动补全建议、代码检查和语法高亮显示;
所有这些都在您最爱的编辑器插件: The ApiHug - API design Copilot

了解更多, 插件

无缝集成到您工具链

基于 Gradle的扩展,让你在应对不同规模:小到单个模块、大到企业级多模块项目时游刃有余;
无缝集成到现有设施, 快速自动化构建,便捷高效分发。

了解更多, 工具链
api.proto
wire.json
syntax = "proto3";
service OrderService {
rpc Place (PlaceOrderRequest)
returns (OrderPlacedResponse) {
option (hope.swagger.operation) = {
get: "/place";
description: "place a new order";
};
}
}
OrderService.java
Terminal
gradlew clean -x test -w

高效开发

模块共享、版本控制、API仓库;
标准API设计元语,面向协议,单信任源(Single Source of Truth),统一IDE,让协同更高效。

了解更多, 组件复用

Prognosis Negative

Rating
PG-13
Year
2021
Genre
Comedy
Runtime
1h 46m
Cast
Simon Pegg, Zach Galifianakis

Rochelle, Rochelle

Rating
R
Year
2020
Genre
Romance
Runtime
1h 56m
Cast
Emilia Clarke
syntax = "proto3";
import "";

message Movie {

  string name = 1 [(hope.swagger.field) = {
    description: "name of the movie";
    example: "The Lord of the Rings"
    empty: FALSE;
    mock: { nature: MOVIE }
    max_length: { value: 64 }
  }];

  MovieLevel level = 2 [(hope.swagger.field) = {
    description: "level of the movie";
    example: "PG_13"
    empty: FALSE;
  }];

  uint32 year = 3 [(hope.swagger.field) = {
    description: "publish year";
    example: "2022"
  }];

}

数据库设计

直观设计 + 高效的代码生成 = 优雅数据库设计;
从API到数据访问,面面俱到。

了解更多, 数据模型

Movie Entity

Column
Type
Id
BIGINT
Name
VARCHAR(64)
Description
VARCHAR(255)
Level
VARCHAR(16)
Year
INT
Type
VARCHAR(32)
Created
DATETIME
Updated
DATETIME

entity.proto

syntax = "proto3";
message Movie {

 string name = 1 [(hope.persistence.column) = {
   name: "NAME", description: "Name of the movie",
   type: VARCHAR, length: { value: 64}
 }];

 string description = 2 [(hope.persistence.column) = {
   name: "DESCRIPTION", description: "description of the movie",
   type: VARCHAR, length: { value: 255 }
 }];

 MovieLevel level = 3 [(hope.persistence.column) = {
   name: "LEVEL", enum_type: STRING,
   type: VARCHAR, length: { value: 16 }
 }];

 option (hope.persistence.table) = {
   name: "MOVIE", description: "Movie",
   wires: [IDENTIFIABLE, AUDITABLE]
 };
}

liquibase.xml

<createTable remarks="Movie" tableName="MOVIE">
<column name="ID" type="BIGINT" autoIncrement="true">
<constraints nullable="false" primaryKey="true" unique="true"></constraints>
</column>
<column name="NAME" type="VARCHAR(64)" remarks="name of the movie">
<constraints nullable="false"></constraints>
</column>
<column name="DESCRIPTION" type="VARCHAR(255)" remarks="description of the movie">
<constraints nullable="false"></constraints>
</column>
<column name="CREATED" type="TIMESTAMP" remarks="Record deleted at"></column>
</createTable>

ApiHug让你走得更快、更远

利用专业开发工具、直观的设计工具和代码生成,快速开发企业级组件;
现代化、轻量级的Java框架最大程度地提升了开发者在一个集成、强大的企业平台上的效能

Learn more