Giter Site home page Giter Site logo

oda-api-sdk-rust's Introduction

Build

Building the ODA Open API SDK for Rust.

Tooling

Install Rust.
Install OpenAPI Generator.

Generate

Generate a client and server for each ODA Open API.

TMF634

openapi-generator-cli generate --generator-name rust-server --output tmf634 --additional-properties packageName=oda_sdk_tmf634 -i https://raw.githubusercontent.com/tmforum-apis/TMF634_ResourceCatalog/master/TMF634-ResourceCatalog-v4.1.0.swagger.json

TMF639

openapi-generator-cli generate --generator-name rust-server --output tmf639 --additional-properties packageName=oda_sdk_tmf639 -i https://raw.githubusercontent.com/tmforum-apis/TMF639_ResourceInventory/master/TMF639-ResourceInventory-v4.0.0.swagger.json

Patch

Pending resolution of BUG17136 it is necesssary to patch the generated models for the servers:

sed -ie '/#\[validate(/a            length(min=1)' tmf{634,639}/src/models.rs

Build SDK

cargo build --workspace

Document SDK

cargo doc --workspace

Build Examples

cargo build --examples --workspace

Run Examples

cargo run --package oda_sdk_tmf634 --example client -- --help
cargo run --package oda_sdk_tmf634 --example server -- --help
cargo run --package oda_sdk_tmf639 --example client -- --help
cargo run --package oda_sdk_tmf639 --example server -- --help

oda-api-sdk-rust's People

Contributors

vances avatar vkatsuba avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

vances

oda-api-sdk-rust's Issues

Include `filter` Query Parameter in OAS

oda-api-sdk-rust version

Any

OS version

Any

Description

  • Motivation
    Query parameters, other than those defined in the OAS, are not handled by code generators.
  • Proposal
    TM Forum should include the filter parameter, as defined in TMF630 Part 6 JSONPath, in their OAS. This has been proposed in a post to their community forum: Filter Parameter Missing in Swagger OAS.

Until that proposal is implemented we should customize the code generation to include the filter parameter.

This wouldn't completely solve the issue however as TMF630 Part 1 defines the use of query parameters matching item attribute names. In order to support these, and other custom uses, it would be necessary to include all the (other?) query parameters in an additional argument to the handlers.

Current behavior

The code produced by openapi-generator includes function arguments for only the query parameters defined in the OAS. Any extra query parameters are unavailable to the handler.

Expected behavior

It should be possible to limit the returned items from a GET operation on a collection.

API specification url is a broken link

The link provided in the command line of openapi-generator-cli refers to a broken link. There should be a mechanism to have this points to a valid resource. @vkatsuba, created the issue as suggested in the slack.

Array Size Validation

oda-api-sdk-rust version

0.1.0

OS version

Any

Steps to reproduce

Run openapi-generator-cli with the rust or rust-server generator.

Current behavior

Results in tmf*/src/models.rs containing an empty serde attribute [#validate()] which prevents cargo build from succeeding.

Expected behavior

The Rust generators should map minItems:1 and maxItems:10 in the OAS to [#validate(length(min=1,max=10)].

This is BUG17136 in the OpenAPITools/openapi-generator project.

Rename current CI to POW

oda-api-sdk-rust version

latest

OS version

All

Description

  • Motivation
    Current project expect sub folders with Rust code base. This code base should be covered by tests and those tests check should be added into CI. Currently existing CI has wrong names - because it actually provide a demo of POW(Prof Of Work) of build Rust SDK over Open API generator. It make sense rename CI to POW.
  • Proposal
    Rename existing CI to POW.

Current behavior

The CI has wrong names which can confuse, because current CI provide POW - not a source code of project.

Expected behavior

The CI for POW has correct names.

Config

N/A

Create base client/server Rust projects

oda-api-sdk-rust version

latest

OS version

All

Description

  • Motivation
    In Rust SDK should be implemented client/server projects.
  • Proposal
    Create base client/server projects over cargo:
$ cargo new client
$ cargo new server

Current behavior

Missed client/server projects.

Expected behavior

The client/server projects are added.

Config

Default configuration which implemented by cargo.

Package Naming

Considering how package names will appear in crates.io holistically I suggest the following:

  1. all packages created by oda-components.org shall have a common prefix: oda.
  2. second component of package name shall indicate category: sdk | ri
  3. third component may indicate TMF designator: tmf639 | tmfc012
  4. Rust packages names shall use snake case

Therefore we should use package names in the oda-api-sdk-rust project like:

  • oda_sdk_tmf634
  • oda_sdk_tmf639

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.