Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs from openapi generator to docs + render all api docs + add u… #17

Merged
merged 10 commits into from
Nov 7, 2024
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
name: Docs
name: Julia docs

on:
push:
branches:
- main
paths:
- "docs/**"
- "src/**"
- "*.toml"
- "RemoteBMI.jl/docs/**"
- "RemoteBMI.jl/src/**"
- "RemoteBMI.jl/*.toml"
- .github/workflows/julia-docs.yml
tags: ["*"]
pull_request:
branches:
- main
paths:
- "docs/**"
- "src/**"
- "*.toml"
- "RemoteBMI.jl/docs/**"
- "RemoteBMI.jl/src/**"
- "RemoteBMI.jl/*.toml"
- .github/workflows/julia-docs.yml
types: [opened, synchronize, reopened]

concurrency:
Expand All @@ -33,6 +35,7 @@ jobs:
- uses: julia-actions/setup-julia@v2
with:
version: "1"
project: './RemoteBMI.jl'
- name: Use Julia cache
uses: julia-actions/cache@v2
- name: Instantiate environment with development version of the package
Expand All @@ -41,17 +44,19 @@ jobs:
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()'
working-directory: RemoteBMI.jl
- name: Run doctest
run: |
julia --project=docs -e '
using Documenter: DocMeta, doctest
using RemoteBMI
DocMeta.setdocmeta!(RemoteBMI, :DocTestSetup, :(using RemoteBMI); recursive=true)
doctest(RemoteBMI)'
working-directory: RemoteBMI.jl
- name: Generate and deploy documentation
run: julia --project=docs docs/make.jl
working-directory: RemoteBMI.jl
env:
JULIA_PKG_SERVER: ""
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
GKSwstype: "100" # https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988
1 change: 1 addition & 0 deletions .github/workflows/julia-test-on-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- "RemoteBMI.jl/src/**"
- "RemoteBMI.jl/test/**"
- "RemoteBMI.jl/*.toml"
- .github/workflows/julia-test-on-prs.yml
types: [opened, synchronize, reopened]

concurrency:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The [Basic Model Interface (BMI)](https://bmi.readthedocs.io/en/stable/) is a standard interface for models.
The interface is available in different languages and a [language agnosting version in SIDL](https://github.com/csdms/bmi/blob/stable/bmi.sidl).

To have a consumer of the model and the provider of the model seperated you can use [grpc4bmi](), but this only works on languages that have a grpc implementation.
To have a consumer of the model and the provider of the model seperated you can use [grpc4bmi](https://grpc4bmi.readthedocs.io/), but this only works on languages that have a grpc implementation.
This repo replaced the gRPC protocol with an REST API.
The [REST API specification](openapi.yaml) is in the [OpenAPI](https://swagger.io/specification/) format.

Expand Down
15 changes: 14 additions & 1 deletion RemoteBMI.jl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,18 @@ The openapi server stubs where generated using the following command:
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.9.0/openapi-generator-cli-7.9.0.jar -O openapi-generator-cli.jar
java -jar ./openapi-generator-cli.jar generate -i ./openapi.yaml -g julia-server -o julia-server --additional-properties=packageName=BmiServer --additional-properties=exportModels=true
java -jar ./openapi-generator-cli.jar generate -i ./openapi.yaml -g julia-client -o julia-client --additional-properties=packageName=BmiClient --additional-properties=exportModels=true
# Copy the generated files to RemoteBMI.jl/src/
# Copy the generated src
cp -r julia-client/src/* RemoteBMI.jl/src/client/
cp -r julia-server/src/* RemoteBMI.jl/src/server/
# Copy the generated docs
mkdir -p RemoteBMI.jl/docs/src/client/ RemoteBMI.jl/docs/src/server/
cp -r julia-client/docs RemoteBMI.jl/docs/src/client/docs
cp -r julia-server/docs RemoteBMI.jl/docs/src/server/
cp julia-client/README.md RemoteBMI.jl/docs/src/client/
cp julia-server/README.md RemoteBMI.jl/docs/src/server/
# Correct links
touch RemoteBMI.jl/docs/src/client/docs/Int64.md
touch RemoteBMI.jl/docs/src/client/docs/Float64.md
touch RemoteBMI.jl/docs/src/server/docs/Int64.md
touch RemoteBMI.jl/docs/src/server/docs/Float64.md
```
6 changes: 3 additions & 3 deletions RemoteBMI.jl/docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const numbered_pages = [
makedocs(;
modules = [RemoteBMI],
authors = "",
repo = "https://github.com/eWaterCycle/RemoteBMI.jl/blob/{commit}{path}#{line}",
repo = "https://github.com/eWaterCycle/remotebmi/blob/{commit}{path}#{line}",
sitename = "RemoteBMI.jl",
format = Documenter.HTML(; canonical = "https://eWaterCycle.github.io/RemoteBMI.jl"),
format = Documenter.HTML(; canonical = "https://eWaterCycle.github.io/remotebmi/RemoteBMI.jl"),
pages = ["index.md"; numbered_pages],
)

deploydocs(; repo = "github.com/eWaterCycle/RemoteBMI.jl")
deploydocs(; repo = "github.com/eWaterCycle/remotebmi", dirname="RemoteBMI.jl")
9 changes: 9 additions & 0 deletions RemoteBMI.jl/docs/src/91-developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ Here is how you do it:
1. Run `julia> using LiveServer`
1. Run `julia> servedocs()`

Or

```shell
# Once
julia --project=docs -e ' using Pkg;Pkg.develop(PackageSpec(path=pwd()));Pkg.instantiate()'
# Every time
julia --project=docs -e ' using LiveServer; servedocs()'
```

## Making a new release

To create a new release, you can follow these simple steps:
Expand Down
22 changes: 21 additions & 1 deletion RemoteBMI.jl/docs/src/95-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@ Pages = ["95-reference.md"]
Pages = ["95-reference.md"]
```

## Server

```@autodocs
Modules = [RemoteBMI.Server]
```

## Server generated code

```@autodocs
Modules = [RemoteBMI.Server.BmiServer]
```

## Client

```@autodocs
Modules = [RemoteBMI.Client]
```

## Client generated code

```@autodocs
Modules = [RemoteBMI]
Modules = [RemoteBMI.Client.BmiClient]
```
89 changes: 89 additions & 0 deletions RemoteBMI.jl/docs/src/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Julia API client for BmiClient

OpenAPI specification for the Basic Modeling Interface (BMI). All functions are described on the [BMI homepage](https://bmi.readthedocs.io/).


## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client.

- API version: 2.0
- Generator version: 7.9.0
- Build package: org.openapitools.codegen.languages.JuliaClientCodegen
For more information, please visit [https://www.ewatercycle.org/contact/](https://www.ewatercycle.org/contact/)


## Installation
Place the Julia files generated under the `src` folder in your Julia project. Include BmiClient.jl in the project code.
It would include the module named BmiClient.

Documentation is generated as markdown files under the `docs` folder. You can include them in your project documentation.
Documentation is also embedded in Julia which can be used with a Julia specific documentation generator.

## API Endpoints

Class | Method
------------ | -------------
*ExchangeItemsApi* | [**get_component_name**](docs/ExchangeItemsApi.md#get_component_name)<br/>**GET** /get_component_name<br/>
*ExchangeItemsApi* | [**get_input_item_count**](docs/ExchangeItemsApi.md#get_input_item_count)<br/>**GET** /get_input_item_count<br/>
*ExchangeItemsApi* | [**get_input_var_names**](docs/ExchangeItemsApi.md#get_input_var_names)<br/>**GET** /get_input_var_names<br/>
*ExchangeItemsApi* | [**get_output_item_count**](docs/ExchangeItemsApi.md#get_output_item_count)<br/>**GET** /get_output_item_count<br/>
*ExchangeItemsApi* | [**get_output_var_names**](docs/ExchangeItemsApi.md#get_output_var_names)<br/>**GET** /get_output_var_names<br/>
*GettersApi* | [**get_value**](docs/GettersApi.md#get_value)<br/>**GET** /get_value/{name}<br/>
*GettersApi* | [**get_value_at_indices**](docs/GettersApi.md#get_value_at_indices)<br/>**POST** /get_value_at_indices/{name}<br/>
*GridInformationApi* | [**get_grid_rank**](docs/GridInformationApi.md#get_grid_rank)<br/>**GET** /get_grid_rank/{grid}<br/>
*GridInformationApi* | [**get_grid_size**](docs/GridInformationApi.md#get_grid_size)<br/>**GET** /get_grid_size/{grid}<br/>
*GridInformationApi* | [**get_grid_type**](docs/GridInformationApi.md#get_grid_type)<br/>**GET** /get_grid_type/{grid}<br/>
*IRFApi* | [**finalize**](docs/IRFApi.md#finalize)<br/>**DELETE** /finalize<br/>
*IRFApi* | [**initialize**](docs/IRFApi.md#initialize)<br/>**POST** /initialize<br/>
*IRFApi* | [**update**](docs/IRFApi.md#update)<br/>**POST** /update<br/>
*IRFApi* | [**update_until**](docs/IRFApi.md#update_until)<br/>**POST** /update_until<br/>
*NURCApi* | [**get_grid_x**](docs/NURCApi.md#get_grid_x)<br/>**GET** /get_grid_x/{grid}<br/>
*NURCApi* | [**get_grid_y**](docs/NURCApi.md#get_grid_y)<br/>**GET** /get_grid_y/{grid}<br/>
*NURCApi* | [**get_grid_z**](docs/NURCApi.md#get_grid_z)<br/>**GET** /get_grid_z/{grid}<br/>
*SettersApi* | [**set_value**](docs/SettersApi.md#set_value)<br/>**POST** /set_value/{name}<br/>
*SettersApi* | [**set_value_at_indices**](docs/SettersApi.md#set_value_at_indices)<br/>**POST** /set_value_at_indices/{name}<br/>
*TimeInformationApi* | [**get_current_time**](docs/TimeInformationApi.md#get_current_time)<br/>**GET** /get_current_time<br/>
*TimeInformationApi* | [**get_end_time**](docs/TimeInformationApi.md#get_end_time)<br/>**GET** /get_end_time<br/>
*TimeInformationApi* | [**get_start_time**](docs/TimeInformationApi.md#get_start_time)<br/>**GET** /get_start_time<br/>
*TimeInformationApi* | [**get_time_step**](docs/TimeInformationApi.md#get_time_step)<br/>**GET** /get_time_step<br/>
*TimeInformationApi* | [**get_time_units**](docs/TimeInformationApi.md#get_time_units)<br/>**GET** /get_time_units<br/>
*UniformRectilinearApi* | [**get_grid_origin**](docs/UniformRectilinearApi.md#get_grid_origin)<br/>**GET** /get_grid_origin/{grid}<br/>
*UniformRectilinearApi* | [**get_grid_shape**](docs/UniformRectilinearApi.md#get_grid_shape)<br/>**GET** /get_grid_shape/{grid}<br/>
*UniformRectilinearApi* | [**get_grid_spacing**](docs/UniformRectilinearApi.md#get_grid_spacing)<br/>**GET** /get_grid_spacing/{grid}<br/>
*UnstructuredApi* | [**get_grid_edge_count**](docs/UnstructuredApi.md#get_grid_edge_count)<br/>**GET** /get_grid_edge_count/{grid}<br/>
*UnstructuredApi* | [**get_grid_edge_nodes**](docs/UnstructuredApi.md#get_grid_edge_nodes)<br/>**GET** /get_grid_edge_nodes/{grid}<br/>
*UnstructuredApi* | [**get_grid_face_count**](docs/UnstructuredApi.md#get_grid_face_count)<br/>**GET** /get_grid_face_count/{grid}<br/>
*UnstructuredApi* | [**get_grid_face_edges**](docs/UnstructuredApi.md#get_grid_face_edges)<br/>**GET** /get_grid_face_edges/{grid}<br/>
*UnstructuredApi* | [**get_grid_face_nodes**](docs/UnstructuredApi.md#get_grid_face_nodes)<br/>**GET** /get_grid_face_nodes/{grid}<br/>
*UnstructuredApi* | [**get_grid_node_count**](docs/UnstructuredApi.md#get_grid_node_count)<br/>**GET** /get_grid_node_count/{grid}<br/>
*UnstructuredApi* | [**get_grid_nodes_per_face**](docs/UnstructuredApi.md#get_grid_nodes_per_face)<br/>**GET** /get_grid_nodes_per_face/{grid}<br/>
*VariableInformationApi* | [**get_var_grid**](docs/VariableInformationApi.md#get_var_grid)<br/>**GET** /get_var_grid/{name}<br/>
*VariableInformationApi* | [**get_var_itemsize**](docs/VariableInformationApi.md#get_var_itemsize)<br/>**GET** /get_var_itemsize/{name}<br/>
*VariableInformationApi* | [**get_var_location**](docs/VariableInformationApi.md#get_var_location)<br/>**GET** /get_var_location/{name}<br/>
*VariableInformationApi* | [**get_var_nbytes**](docs/VariableInformationApi.md#get_var_nbytes)<br/>**GET** /get_var_nbytes/{name}<br/>
*VariableInformationApi* | [**get_var_type**](docs/VariableInformationApi.md#get_var_type)<br/>**GET** /get_var_type/{name}<br/>
*VariableInformationApi* | [**get_var_units**](docs/VariableInformationApi.md#get_var_units)<br/>**GET** /get_var_units/{name}<br/>


## Models

- [GetComponentNameResponse](docs/GetComponentNameResponse.md)
- [GetGridTypeResponse](docs/GetGridTypeResponse.md)
- [GetTimeUnitsResponse](docs/GetTimeUnitsResponse.md)
- [GetVarLocationResponseLocation](docs/GetVarLocationResponseLocation.md)
- [GetVarTypeResponse](docs/GetVarTypeResponse.md)
- [GetVarUnitsResponse](docs/GetVarUnitsResponse.md)
- [InitializeRequest](docs/InitializeRequest.md)
- [ProblemDetails](docs/ProblemDetails.md)
- [SetValueAtIndicesRequest](docs/SetValueAtIndicesRequest.md)


<a id="authorization"></a>
## Authorization
Endpoints do not require authorization.


## Author



143 changes: 143 additions & 0 deletions RemoteBMI.jl/docs/src/client/docs/ExchangeItemsApi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# ExchangeItemsApi

All URIs are relative to *http://localhost:50051*

Method | HTTP request | Description
------------- | ------------- | -------------
[**get_component_name**](ExchangeItemsApi.md#get_component_name) | **GET** /get_component_name |
[**get_input_item_count**](ExchangeItemsApi.md#get_input_item_count) | **GET** /get_input_item_count |
[**get_input_var_names**](ExchangeItemsApi.md#get_input_var_names) | **GET** /get_input_var_names |
[**get_output_item_count**](ExchangeItemsApi.md#get_output_item_count) | **GET** /get_output_item_count |
[**get_output_var_names**](ExchangeItemsApi.md#get_output_var_names) | **GET** /get_output_var_names |


# **get_component_name**
> get_component_name(_api::ExchangeItemsApi; _mediaType=nothing) -> GetComponentNameResponse, OpenAPI.Clients.ApiResponse <br/>
> get_component_name(_api::ExchangeItemsApi, response_stream::Channel; _mediaType=nothing) -> Channel{ GetComponentNameResponse }, OpenAPI.Clients.ApiResponse



Get the name of the model component.

### Required Parameters
This endpoint does not need any parameter.

### Return type

[**GetComponentNameResponse**](GetComponentNameResponse.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)

# **get_input_item_count**
> get_input_item_count(_api::ExchangeItemsApi; _mediaType=nothing) -> Int64, OpenAPI.Clients.ApiResponse <br/>
> get_input_item_count(_api::ExchangeItemsApi, response_stream::Channel; _mediaType=nothing) -> Channel{ Int64 }, OpenAPI.Clients.ApiResponse



The number of variables the model can use from other models implementing a BMI.

### Required Parameters
This endpoint does not need any parameter.

### Return type

**Int64**

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)

# **get_input_var_names**
> get_input_var_names(_api::ExchangeItemsApi; _mediaType=nothing) -> Vector{String}, OpenAPI.Clients.ApiResponse <br/>
> get_input_var_names(_api::ExchangeItemsApi, response_stream::Channel; _mediaType=nothing) -> Channel{ Vector{String} }, OpenAPI.Clients.ApiResponse



Gets an array of names for the variables the model can use from other models implementing a BMI.

### Required Parameters
This endpoint does not need any parameter.

### Return type

**Vector{String}**

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)

# **get_output_item_count**
> get_output_item_count(_api::ExchangeItemsApi; _mediaType=nothing) -> Int64, OpenAPI.Clients.ApiResponse <br/>
> get_output_item_count(_api::ExchangeItemsApi, response_stream::Channel; _mediaType=nothing) -> Channel{ Int64 }, OpenAPI.Clients.ApiResponse



The number of variables the model can provide other models implementing a BMI.

### Required Parameters
This endpoint does not need any parameter.

### Return type

**Int64**

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)

# **get_output_var_names**
> get_output_var_names(_api::ExchangeItemsApi; _mediaType=nothing) -> Vector{String}, OpenAPI.Clients.ApiResponse <br/>
> get_output_var_names(_api::ExchangeItemsApi, response_stream::Channel; _mediaType=nothing) -> Channel{ Vector{String} }, OpenAPI.Clients.ApiResponse



Gets an array of names for the variables the model can provide to other models implementing a BMI.

### Required Parameters
This endpoint does not need any parameter.

### Return type

**Vector{String}**

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)

Empty file.
Loading
Loading