Skip to content

Commit

Permalink
feat: Implement openapi client code generator | NPG-6475 (#580)
Browse files Browse the repository at this point in the history
# Description

Implement openapi client generator to automatically generate
cat-data-service client code

## Type of change

- [X] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [X] This change requires a documentation update

## How Has This Been Tested?

- [X] Navigate to the test folder and run
`earthly +generate-client`

## Checklist

- [X] My code follows the style guidelines of this project
- [X] I have performed a self-review of my code
- [X] I have commented my code, particularly in hard-to-understand areas
- [X] I have made corresponding changes to the documentation
- [X] My changes generate no new warnings
- [X] I have added tests that prove my fix is effective or that my
feature works
- [X] New and existing unit tests pass locally with my changes
- [X] Any dependent changes have been merged and published in downstream
modules
  • Loading branch information
nicopado authored Oct 4, 2023
1 parent da44c0c commit c2c0c82
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ result*
.vscode
**/.idea/
.temp/
tests/tmp/

# std
.std
Expand Down
27 changes: 27 additions & 0 deletions tests/Earthfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
VERSION 0.7

FROM debian:stable-slim

# BASH, CURL, GPG, NODEJS, NPM, JRE
dependencies:
RUN apt-get update
RUN apt-get install bash
RUN apt-get install curl -y
RUN apt-get install gpg -y
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN apt-get install nodejs -y
RUN apt-get install npm -y
RUN apt-get install default-jre -y

generate-client:
FROM +dependencies

# TODO(@nicopado): Get the correct file from openapi doc generation target - https://github.com/input-output-hk/catalyst-core/issues/589
ARG openapispec_file="./petstore.yaml"
COPY $openapispec_file .

RUN npm install @openapitools/openapi-generator-cli -g

RUN openapi-generator-cli validate -i $openapispec_file

RUN openapi-generator-cli generate -i $openapispec_file -g rust -o ./tmp/client/ --package-name cat-data-service-client

0 comments on commit c2c0c82

Please sign in to comment.