MyGit

manticoresoftware/openapi

Fork: 8 Star: 5 (更新于 2024-11-18 23:04:17)

license: MIT

Language: Mustache .

Manticore Search clients generator

GitHub网址

Manticore Search OpenAPI client generator

This project allows you to automatically generate Manticore Search clients for different languages.

For this purpose, the OpenApi Generator tool is used. More info can be found here.

To generate a client, the OpenApi generator needs a config file describing the structure of API. The file is manticore.yml.
To edit and validate the config, you can use an online editor such as Swagger.

Generated clients

  • Python - it also has a testing suite with incomplete coverage

  • .Net - it also has a testing suite with incomplete coverage

  • Javascript - it also has a testing suite with incomplete coverage

  • Java - it also has a testing suite with incomplete coverage

  • Elixir - it also has a testing suite with incomplete coverage

  • Typescript - it also has a testing suite with incomplete coverage

Contributing

When proposing a Pull Request (PR) for a client, please ensure that your PR modifies only the corresponding client templates, not the client code itself, which is stored in the 'out' folder. The client code is generated automatically via GitHub CI, so it is not necessary to add it explicitly.

Building

The simplest way to make a build for a specific language, e.g., for Java, is to use our build script:

./build.sh java

You can also build versions for all supported languages at once:

./build.sh all

By default, the latest available version of the OpenApi generator will be used. If you want to apply a specific version, add a corresponding argument to the command call:

build.sh Java v5.0.0   

where v5.0.0 is a tag of the generator's Docker image you need.

The current versions used are 'v6.6.0' for Java and 'v6.1.0.' for the rest of the clients.

Note that you can also use Docker and run the OpenApi generator Docker image directly:

docker pull  openapitools/openapi-generator-cli 

docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/manticore.yaml -g java -o /local/out/java

Custom overrides

Using the Docker way for generating clients, you should also apply your custom overrides when it's necessary (for example, to change package names).

By default, the generators use standard package names (like openapi_client). These names need to be changed at build time (since this is not a responsibility of the OpenAPI spec to define how a package for a language must be named).

Package or Project names have their specific variables for each language (there are some general variables for the api/model package, but some generators don't use them!). There are also other variables that may require a custom value to be set for them. To see these, run

docker run --rm -v ${PWD}:/local  -u "$(id -u):$(id -g)" -e JAVA_OPTS="-Dlog.level=warn" openapitools/openapi-generator-cli config-help -g XXX

where XXX is the name of the generator (language).

To add these specific variables, use --additional-properties NAME=VALUE in the docker run command (see build.sh for examples).

Please note that for Java, the library used is okhttp-gson, and some of its templates (like the readme) must be edited in the templates/Java/libraries/okhttp-gson/ folder.

Project folders

  • out - contains the code of generated clients. Each client is located in a folder named manticore-X where X is a client's language.

  • patches - contains patch files for various clients

  • test - contains hand-made or modified generated tests (it's desirable to copy them to the corresponding subfolder of manticore-X)

  • templates - contains mustache templates taken from https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources; These should be updated from time to time

  • docs - contains the documentation parts for generated clients which cannot be correctly generated in auto mode.

Specific client issues

JavaScript

  • delete() is renamed to callDelete because delete() is a reserved method - the only appropriate fix is to rename doc operations to something else (like deleteDocuments())

最近版本更新:(数据更新于 1970-01-01 00:00:00)

manticoresoftware/openapi同语言 Mustache最近更新仓库

2024-11-21 16:59:15 argoproj/argo-helm

2024-10-17 15:40:11 jumpserver/helm-charts

2024-09-21 17:16:49 jenkinsci/helm-charts

2024-08-27 16:24:53 goharbor/harbor-helm

2024-08-24 00:03:52 codecentric/helm-charts

2024-08-10 06:47:46 aws/eks-charts