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 rpc.describe RPC method: JSON Schema Service Descriptor #412

Merged
merged 1 commit into from
Apr 5, 2023

Conversation

nycholas
Copy link
Member

@nycholas nycholas commented Apr 5, 2023

It is the first change related to JSON-RPC Service Descriptor and enhancement of Web Browsable API. The aim of these changes is to create Metadata of the RPC method to be used by Web Browsable API. The idea here is open the space to use typing.Annotated[1] in parameters (and returns) and reflecting that in Web Browsable API, such as:

def fn(
    name: typing.Annotated[str, MaxLenght(60), "First and last name of person"],
    age: typing.Annotated[int, ValueRange(1, 110), "Age of person"],
   ...
) -> typing.Annotated[str, "The data information of person"]:

The service descriptor was based on JSON Schema Service Descriptor from JSON-RPC Spec[2], some changes were made to be more seems like OpenRPC Spec[3], and others will do to adapt to the use case of Web Browsable API.

Note: The RPC method system.describe was removed (replaced by rcp.describe).

Resolves: #409
See also: #376

[1] - https://docs.python.org/3/library/typing.html#typing.Annotated
[2] - https://www.jsonrpc.org/historical/json-schema-service-descriptor.html
[3] - https://spec.open-rpc.org/

It is the first change related to JSON-RPC Service Descriptor and
enhancement of Web Browsable API. The aim of these changes is to
create Metadata of the RPC method to be used by Web Browsable API.
The idea here is open the space to use `typing.Annotated`[1] in
parameters (and returns) and reflecting that in Web Browsable API,
such as:

```
def fn(
    name: typing.Annotated[str, MaxLenght(60), "First and last name of person"],
    age: typing.Annotated[int, ValueRange(1, 110), "Age of person"],
   ...
) -> typing.Annotated[str, "The data information of person"]:
```

The service descriptor was based on JSON Schema Service Descriptor
from JSON-RPC Spec[2], some changes were made to be more seems like
OpenRPC Spec[3], and others will do to adapt to the use case of Web
Browsable API.

**Note:** The RPC method `system.describe` was removed (replaced
by `rcp.describe`).

Resolves: #409
See also: #376

[1] - https://docs.python.org/3/library/typing.html#typing.Annotated
[2] - https://www.jsonrpc.org/historical/json-schema-service-descriptor.html
[3] - https://spec.open-rpc.org/
@nycholas nycholas merged commit f94dac0 into master Apr 5, 2023
14 checks passed
@nycholas nycholas deleted the feature/409-service-descriptor branch April 5, 2023 22:27
nycholas added a commit that referenced this pull request Jan 19, 2024
* Add support to Python 3.12 (#431)
* Drop support to Python 3.7
* Bump Flask version to >=3.0.0
* Bump JQuery version from 1.8.1 to 3.7.1 (fix security issue)
* Bump several dependencies versions
* Migrate configuration to pyproject.toml
* Reorganizze requirements files
* Remove flask_jsonrpc.__version__ attribute in favor to pyproject.toml version attribute
* Add multi Python version on update workflow (#332)
* Add new param to allow/disallow JSON-RPC Notification (#385)
* Unified API Browser when using modular server (#391)
* Add tests to all Python versions supported by the project (#395)
* Add e2e tests to Web Browsable API (#401)
* Goodbye Python 3.6 (#404)
* Add support to Python 3.11 (#408)
* Add rpc.describe RPC method: JSON Schema Service Descriptor (#412)
* Project links fixed (#429)
@nycholas nycholas mentioned this pull request Jan 19, 2024
nycholas added a commit that referenced this pull request Jan 19, 2024
* Add GitHub Action for coveralls

* Version 3.0.0

* Add support to Python 3.12 (#431)
* Drop support to Python 3.7
* Bump Flask version to >=3.0.0
* Bump JQuery version from 1.8.1 to 3.7.1 (fix security issue)
* Bump several dependencies versions
* Migrate configuration to pyproject.toml
* Reorganizze requirements files
* Remove flask_jsonrpc.__version__ attribute in favor to pyproject.toml version attribute
* Add multi Python version on update workflow (#332)
* Add new param to allow/disallow JSON-RPC Notification (#385)
* Unified API Browser when using modular server (#391)
* Add tests to all Python versions supported by the project (#395)
* Add e2e tests to Web Browsable API (#401)
* Goodbye Python 3.6 (#404)
* Add support to Python 3.11 (#408)
* Add rpc.describe RPC method: JSON Schema Service Descriptor (#412)
* Project links fixed (#429)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSON Schema Service Descriptor
1 participant