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

feat(server): removed experimental decorators #259

Merged
merged 8 commits into from
Apr 19, 2023

Conversation

basmasking
Copy link
Member

Fixes #253

Changes proposed in this pull request:

  • Removed the decorators from the configurations / models
  • Implemented zod to validate the configurations / models
  • Use zod for object conversion

@MaskingTechnology/jitar

@basmasking basmasking linked an issue Apr 19, 2023 that may be closed by this pull request
import { IsBoolean } from 'class-validator';
import { z } from 'zod';

export const schema = z.object({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.object (and others) should start at a new line

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the whole object. It was not used

import { ArrayNotEmpty, IsUrl } from 'class-validator';
import { z } from 'zod';

export const schema = z.object({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.object (and others) should start at a new line

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

import StandaloneConfiguration from './StandaloneConfiguration.js';
import { z } from 'zod';

import GatewayConfiguration, { schema as gatewaySchema } from './GatewayConfiguration.js';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rename the exports of the schemas to avoid renaming them in the import?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Processed

@@ -1,19 +1,17 @@

import { readFileSync } from 'fs';

import RuntimeConfiguration from '../configuration/RuntimeConfiguration.js';
import RuntimeConfiguration, { schema as RuntimeSchema } from '../configuration/RuntimeConfiguration.js';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runtimeSchema (starting with a lower case)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@petermasking petermasking merged commit 88af5a7 into main Apr 19, 2023
@petermasking petermasking deleted the 253-replace-decorators-with-zod-for-validation branch April 19, 2023 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace decorators with zod for validation
2 participants