Skip to content

Commit

Permalink
ignore unknown fields on proto parse and update contracts (#3714)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianedwards authored Oct 3, 2023
1 parent 0e74c11 commit a5e3736
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 17 deletions.
14 changes: 7 additions & 7 deletions dashboard/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@loadable/component": "^5.15.2",
"@material-ui/core": "^4.11.3",
"@material-ui/lab": "^4.0.0-alpha.61",
"@porter-dev/api-contracts": "^0.2.6",
"@porter-dev/api-contracts": "^0.2.8",
"@react-spring/web": "^9.6.1",
"@sentry/react": "^6.13.2",
"@sentry/tracing": "^6.13.2",
Expand Down
4 changes: 3 additions & 1 deletion dashboard/src/lib/hooks/useAppValidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ export const useAppValidation = ({
.parseAsync(res.data);

const validatedAppProto = PorterApp.fromJsonString(
atob(validAppData.validate_b64_app_proto)
atob(validAppData.validate_b64_app_proto), {
ignoreUnknownFields: true,
}
);

return { validatedAppProto: validatedAppProto, variables, secrets };
Expand Down
9 changes: 7 additions & 2 deletions dashboard/src/lib/hooks/usePorterYaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ export const usePorterYaml = ({
.optional(),
})
.parseAsync(res.data);
const proto = PorterApp.fromJsonString(atob(data.b64_app_proto));
const proto = PorterApp.fromJsonString(atob(data.b64_app_proto), {
ignoreUnknownFields: true,
});

const { services, predeploy, build } = serviceOverrides({
overrides: proto,
Expand All @@ -142,7 +144,10 @@ export const usePorterYaml = ({

if (data.preview_app) {
const previewProto = PorterApp.fromJsonString(
atob(data.preview_app.b64_app_proto)
atob(data.preview_app.b64_app_proto),
{
ignoreUnknownFields: true,
}
);
const {
services: previewServices,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,9 @@ const AppDataContainer: React.FC<AppDataContainerProps> = ({ tabParam }) => {
reset({
app: clientAppFromProto({
proto: previewRevision
? PorterApp.fromJsonString(atob(previewRevision.b64_app_proto))
? PorterApp.fromJsonString(atob(previewRevision.b64_app_proto), {
ignoreUnknownFields: true,
})
: latestProto,
overrides: servicesFromYaml,
variables: appEnv?.variables,
Expand All @@ -303,7 +305,9 @@ const AppDataContainer: React.FC<AppDataContainerProps> = ({ tabParam }) => {
reset({
app: clientAppFromProto({
proto: previewRevision
? PorterApp.fromJsonString(atob(previewRevision.b64_app_proto))
? PorterApp.fromJsonString(atob(previewRevision.b64_app_proto), {
ignoreUnknownFields: true,
})
: latestProto,
overrides: servicesFromYaml,
variables: appEnv?.variables,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ export const LatestRevisionProvider = ({
return;
}

return PorterApp.fromJsonString(atob(latestRevision.b64_app_proto));
return PorterApp.fromJsonString(atob(latestRevision.b64_app_proto), {
ignoreUnknownFields: true,
});
}, [latestRevision]);

if (
Expand Down
7 changes: 6 additions & 1 deletion dashboard/src/main/home/app-dashboard/apps/AppGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ const AppGrid: React.FC<AppGridProps> = ({ apps, searchValue, view, sort }) => {
...app,
app_revision: {
...app.app_revision,
proto: PorterApp.fromJsonString(atob(app.app_revision.b64_app_proto)),
proto: PorterApp.fromJsonString(
atob(app.app_revision.b64_app_proto),
{
ignoreUnknownFields: true,
}
),
},
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ const RevisionTableContents: React.FC<RevisionTableContentsProps> = ({
const revisionsWithProto = revisions.map((revision) => {
return {
...revision,
app_proto: PorterApp.fromJsonString(atob(revision.b64_app_proto)),
app_proto: PorterApp.fromJsonString(atob(revision.b64_app_proto), {
ignoreUnknownFields: true,
}),
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ const RevisionsList: React.FC<Props> = ({
setValue(
"app",
clientAppFromProto({
proto: PorterApp.fromJsonString(atob(app_revision.b64_app_proto)),
proto: PorterApp.fromJsonString(atob(app_revision.b64_app_proto), {
ignoreUnknownFields: true,
}),
overrides: servicesFromYaml,
variables: app_revision.env.variables,
secrets: app_revision.env.secret_variables,
Expand Down

0 comments on commit a5e3736

Please sign in to comment.