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

Fix bug where function configuration with null couldn't be deployed. #1246

Merged
merged 2 commits into from Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1 +1,2 @@
- Fix reference docs for performance monitoring.
- Fix bug where function configuration wil null values couldn't be deployed. (#1246)
30 changes: 30 additions & 0 deletions spec/runtime/manifest.spec.ts
Expand Up @@ -7,6 +7,36 @@ describe('stackToWire', () => {
params.clearParams();
});

it('converts stack with null values values', () => {
const stack: ManifestStack = {
endpoints: {
v2http: {
platform: 'gcfv2',
entryPoint: 'v2http',
labels: {},
httpsTrigger: {},
maxInstances: null,
},
},
requiredAPIs: [],
specVersion: 'v1alpha1',
};
const expected = {
endpoints: {
v2http: {
platform: 'gcfv2',
entryPoint: 'v2http',
labels: {},
httpsTrigger: {},
maxInstances: null,
},
},
requiredAPIs: [],
specVersion: 'v1alpha1',
};
expect(stackToWire(stack)).to.deep.equal(expected);
});

it('converts Expression types in endpoint options to CEL', () => {
const intParam = params.defineInt('foo', { default: 11 });
const stringParam = params.defineString('bar', {
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/manifest.ts
Expand Up @@ -107,7 +107,7 @@ export function stackToWire(stack: ManifestStack): Object {
for (const [key, val] of Object.entries(obj)) {
if (val instanceof Expression) {
obj[key] = val.toCEL();
} else if (typeof val === 'object') {
} else if (typeof val === 'object' && val !== null) {
traverse(val);
}
}
Expand Down