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

Close #729 - @hidden tag for JSON schema #730

Merged
merged 1 commit into from
Jul 31, 2023
Merged

Close #729 - @hidden tag for JSON schema #730

merged 1 commit into from
Jul 31, 2023

Conversation

samchon
Copy link
Owner

@samchon samchon commented Jul 31, 2023

This is a feature requested by sponsor @windofwind.

When @hidden comment tag being used, JSON schema generator ignores that property.

Unlike @internal tag, it would not affect to other typia functions like typia.assert<T>().

import typia from "typia";

interface ISomething {
    id: string;

    /**
     * @hidden
     */
    authority: number;
}
const app: typia.IJsonApplication = typia.application<[ISomething], "ajv">();
const object: typia.IJsonComponents.IObject = (app.components.schemas ?? {})
    .ISomething as typia.IJsonComponents.IObject;
console.log(Object.keys(object.properties)); // ["id"]

> This is a feature requested by sponsor @windofwind.

When `@hidden` comment tag being used, let JSON schema generator to ignore that property.

Unlike `@internal` tag, it would not affect to other `typia` functions like `typia.assert<T>()`.

```typescript
import typia from "typia";

interface ISomething {
    id: string;

    /**
     * @hidden
     */
    authority: number;
}
const app: typia.IJsonApplication = typia.application<[ISomething], "ajv">();
const object: typia.IJsonComponents.IObject = (app.components.schemas ?? {})
    .ISomething as typia.IJsonComponents.IObject;
console.log(Object.keys(object.properties)); // ["id"]
```
@samchon samchon added documentation Improvements or additions to documentation enhancement New feature or request labels Jul 31, 2023
@samchon samchon self-assigned this Jul 31, 2023
Copy link
Owner Author

@samchon samchon left a comment

Choose a reason for hiding this comment

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

OK, no problem.

@samchon samchon merged commit b3b2270 into master Jul 31, 2023
2 checks passed
@samchon samchon deleted the features/hidden branch July 31, 2023 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant