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

Add support for deprecated keyword #441

Closed
bluishoul opened this issue Feb 23, 2022 · 1 comment · Fixed by #542
Closed

Add support for deprecated keyword #441

bluishoul opened this issue Feb 23, 2022 · 1 comment · Fixed by #542

Comments

@bluishoul
Copy link

bluishoul commented Feb 23, 2022

json-schema-spec PR: json-schema-org/json-schema-spec#737

json-schema doc: https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.9.3

Usage:

{
  "$schema": "http://json-schema.org/draft/2019-09/schema#",
  "title": "Example Schema",
  "type": "object",
  "properties": {
    "firstName": {
      "type": "string",
      "deprecated": true
    },
  },
  "additionalProperties": false,
  "required": [
    "firstName"
  ]
}

Expected:

/* tslint:disable */
/**
 * This file was automatically generated by json-schema-to-typescript.
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
 * and run json-schema-to-typescript to regenerate this file.
 */

export interface ExampleSchema {
  /** @deprecated **/
  firstName: string;
}
@bcherny bcherny changed the title Keyword deprecated support Add support for deprecated keyword May 15, 2022
@simonNozaki
Copy link

simonNozaki commented Jun 13, 2022

Hello @bcherny ,

Thank you for such a nice library!(I sometimes use this with serverless framework!)

I want to contribute to this issue. I am new to open source projects, so would you mind if you help me where to look it from?

bcherny pushed a commit that referenced this issue Aug 27, 2023
* Initial support for deprecated keyword

* Remove unnecessary ?

* Fix missing deprecated parameter

* Add e2e test for keyword deprecated

* extended e2e tet to cover deprecated schema and deprecated:false

* Added description property to each item in e2e test to test interaction with the deprecated comment

* Added description property to another object with a true deprecated in e2e test to test outcome of a true deprecated between a true deprecated and a false deprecated

* Fix whitespace and improve comments

* Simplify generateComment

---------

Co-authored-by: iansw246 <35947093+iansw246@users.noreply.github.com>
Co-authored-by: Michelle Tan <michelle0223@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants