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

chore(cat-voices): Filter OpenAPI json for Flutter #1187

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
77d6fc7
chore: First version of filter-openapi job
LynxLynxx Nov 11, 2024
b7766dc
chore: comment out openapi-filters.json copy in Earthfile to avoid co…
LynxLynxx Nov 11, 2024
14a8659
chore: change node image
LynxLynxx Nov 11, 2024
3f0eb41
chore: verbose flag for openapi-format
LynxLynxx Nov 11, 2024
66cdca0
chore: copy openapi-filters
LynxLynxx Nov 11, 2024
b346746
chore: change dir of copy openapi-filters
LynxLynxx Nov 11, 2024
6d471ae
chore: don't delete cat-gateway-api for now
LynxLynxx Nov 11, 2024
066522c
chore: working filtering of openapi json
LynxLynxx Nov 12, 2024
0e5bcf9
fix: default value for using filtered openapi
LynxLynxx Nov 12, 2024
dbb6c34
fix: new filtered cat gateway openAPI files
LynxLynxx Nov 12, 2024
2000c98
Merge branch 'main' into chore/1172_filter-openapi-flutter
minikin Nov 13, 2024
a756ddb
fix: remove unnecessary comments
LynxLynxx Nov 13, 2024
431710a
Merge branch 'chore/1172_filter-openapi-flutter' of github.com:input-…
LynxLynxx Nov 13, 2024
1d606fd
Merge branch 'main' into chore/1172_filter-openapi-flutter
LynxLynxx Nov 13, 2024
46381d8
Merge branch 'main' into chore/1172_filter-openapi-flutter
dtscalac Nov 14, 2024
1ff962f
Merge branch 'main' into chore/1172_filter-openapi-flutter
LynxLynxx Nov 14, 2024
e0bbc2d
Merge branch 'chore/1172_filter-openapi-flutter' of github.com:input-…
LynxLynxx Nov 14, 2024
d01e4b1
fix: update .gitignore and Earthfile for better handling of generated…
LynxLynxx Nov 14, 2024
0376940
fix: modify Earthfile to use filter_openapi ARG and update .gitignore…
LynxLynxx Nov 15, 2024
ac2be1e
Merge branch 'main' into chore/1172_filter-openapi-flutter
minikin Nov 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions catalyst_voices/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*.swagger.dart
*.openapi.dart
*.gen.dart
cat_gateway_api.*.swagger.*

# Un-ignore generated files in public packages
!**/packages/libs/**/*.g.dart
Expand Down
31 changes: 27 additions & 4 deletions catalyst_voices/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,30 @@ builder:
COPY +repo-catalyst-voices/repo .
DO flutter-ci+BOOTSTRAP

# Creates filtered OpenAPI spec
# Takes json file from openapi-filter from /packages/internal/catalyst_voices_services
filter-openapi:
FROM node:18
WORKDIR /packages/internal/catalyst_voices_services

COPY catalyst-gateway+build/doc/cat-gateway-api.json openapi/cat-gateway-api.json
COPY packages/internal/catalyst_voices_services/openapi-filters.json openapi-filters.json

RUN npm install -g openapi-format
RUN openapi-format openapi/cat-gateway-api.json -o openapi/filtered-openapi.json --filterFile openapi-filters.json --verbose

RUN rm openapi/cat-gateway-api.json

SAVE ARTIFACT openapi/filtered-openapi.json

# Generates flutter code.
# Generates codes for Catalyst Gateway OpenAPI, Voices Localization and
# VoicesAssets and other packages that depend on code-generator.
# It accepts [save_locally] ARG that when true place the artifacts in the
# proper folders
code-generator:
ARG save_locally=false
ARG save_locally=false
ARG use_filtered_openapi=true
LynxLynxx marked this conversation as resolved.
Show resolved Hide resolved
FROM +builder
LET gen_code_path = lib/generated/catalyst_gateway
LET local_gen_code_path = packages/internal/catalyst_voices_services/lib/generated/catalyst_gateway/
Expand All @@ -33,16 +50,22 @@ code-generator:
RUN melos build_runner

IF [ $save_locally = true ]
RUN find . \( -name "*.g.dart" -o -name "*.freezed.dart" -o -name "*.chopper.dart" -o -name "*.swagger.dart" -o -name "*.openapi.dart" -o -name "*.gen.dart" -o -name "catalyst_voices_localizations*.dart" \)
RUN find . \( -name "*.g.dart" -o -name "*.freezed.dart" -o -name "*.chopper.dart" -o -name "*.swagger.dart" -o -name "*.openapi.dart" -o -name "*.gen.dart" -o -name "catalyst_voices_localizations*.dart" -o -name "cat_gateway_api.*.swagger.*" \)

FOR generated_file IN $(find . \( -name "*.g.dart" -o -name "*.freezed.dart" -o -name "*.chopper.dart" -o -name "*.swagger.dart" -o -name "*.openapi.dart" -o -name "*.gen.dart" -o -name "catalyst_voices_localizations*.dart" \))
FOR generated_file IN $(find . \( -name "*.g.dart" -o -name "*.freezed.dart" -o -name "*.chopper.dart" -o -name "*.swagger.dart" -o -name "*.openapi.dart" -o -name "*.gen.dart" -o -name "catalyst_voices_localizations*.dart" -o -name "cat_gateway_api.*.swagger.*" \))
SAVE ARTIFACT $generated_file AS LOCAL $generated_file
END
ELSE
SAVE ARTIFACT .
END
WORKDIR packages/internal/catalyst_voices_services
COPY catalyst-gateway+build/doc/cat-gateway-api.json openapi/cat-gateway-api.json

IF [ $use_filtered_openapi = true ]
COPY +filter-openapi/filtered-openapi.json openapi/cat-gateway-api.json
ELSE
COPY catalyst-gateway+build/doc/cat-gateway-api.json openapi/cat-gateway-api.json
END

DO flutter-ci+OPENAPI_CODE_GEN \
--SAVE_LOCALLY=$save_locally \
--GEN_CODE_PATH=$gen_code_path \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"inverseTags": [
"Health",
"Legacy"
],
"operations": [
"*::/api/draft/*"
],
"unusedComponents": [
"schemas",
"parameters",
"examples",
"headers",
"requestBodies",
"responses"
]
}
Loading