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

DX - 556 - Made the version field as optional #108

Merged
merged 1 commit into from
May 10, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions 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 package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "contentstack-cli-tsgen",
"description": "Generate TypeScript typings from a Stack.",
"version": "2.3.2",
"version": "2.3.3",
"author": "Michael Davis",
"bugs": "https://github.com/Contentstack-Solutions/contentstack-cli-tsgen/issues",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tsgen/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export default function (userOptions: TSGenOptions) {
define_interface(contentType, options.systemFields),
'{',
['/**', "Version", '*/'].join(' '),
[`_version: `,contentType._version,';'].join(' '),
[`_version?: `,contentType._version,';'].join(' '),
visit_fields(contentType.schema),
'}',
]
Expand Down
2 changes: 1 addition & 1 deletion tests/tsgen/boolean.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("builtin boolean field", () => {
"export interface IBoolean
{
/** Version */
_version: 2 ;
_version?: 2 ;
title: string ;
boolean?: boolean ;
}"
Expand Down
4 changes: 2 additions & 2 deletions tests/tsgen/defaults.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe("default single content block", () => {
"export interface IMetadataSingleContentBlock
{
/** Version */
_version: 2 ;
_version?: 2 ;
title: string ;
}"
`);
Expand All @@ -44,7 +44,7 @@ describe("default single webpage", () => {
"export interface IMetadataSingleWebpage
{
/** Version */
_version: 2 ;
_version?: 2 ;
title: string ;
url: string ;
}"
Expand Down
4 changes: 2 additions & 2 deletions tests/tsgen/global.fields.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("global fields", () => {
"export interface ISeo
{
/** Version */
_version: ;
_version?: ;
keywords?: string ;
description?: string ;
}"
Expand All @@ -37,7 +37,7 @@ describe("global fields", () => {
"export interface IGlobalFields
{
/** Version */
_version: 2 ;
_version?: 2 ;
title: string ;
seo?: ISeo ;
}"
Expand Down
2 changes: 1 addition & 1 deletion tests/tsgen/group.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("group", () => {
"export interface Group
{
/** Version */
_version: 3 ;
_version?: 3 ;
title: string ;
multiple_group_max_limit?: [{
number?: number | null ;
Expand Down
2 changes: 1 addition & 1 deletion tests/tsgen/isodate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("builtin isodate field", () => {
"export interface Isodate
{
/** Version */
_version: 2 ;
_version?: 2 ;
title: string ;
date?: string | null ;
date_required: string ;
Expand Down
2 changes: 1 addition & 1 deletion tests/tsgen/jsdoc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe("jsdoc", () => {
export interface Jsdoc
{
/** Version */
_version: 3 ;
_version?: 3 ;
/** Name */
title: string ;
/** Age */
Expand Down
2 changes: 1 addition & 1 deletion tests/tsgen/modular.blocks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("modular blocks", () => {
"export interface ModularBlocks
{
/** Version */
_version: 2 ;
_version?: 2 ;
title: string ;
url: string ;
modular_blocks?: ({string_block: {single_line?: string ;
Expand Down
2 changes: 1 addition & 1 deletion tests/tsgen/number.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("builtin number field", () => {
"export interface Number
{
/** Version */
_version: 2 ;
_version?: 2 ;
title: string ;
url: string ;
number?: number | null ;
Expand Down
2 changes: 1 addition & 1 deletion tests/tsgen/options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("all options", () => {
"export interface Options
{
/** Version */
_version: 4 ;
_version?: 4 ;
title: string ;
url: string ;
single_line_textbox_not_required?: string ;
Expand Down
2 changes: 1 addition & 1 deletion tests/tsgen/references.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe("references", () => {
"export interface IReferenceParent
{
/** Version */
_version: 5 ;
_version?: 5 ;
title: string ;
url: string ;
single_reference: (IReferenceChild)[] ;
Expand Down
2 changes: 1 addition & 1 deletion tests/tsgen/select.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("select (dropdown)", () => {
"export interface Select
{
/** Version */
_version: 5 ;
_version?: 5 ;
title: string ;
select_single_value?: (\\"Option 1\\" | \\"Option 2\\" | \\"Option 3\\") | null ;
select_single_value_required: (\\"Test 1\\" | \\"Test 2\\" | \\"Test 3\\") ;
Expand Down
2 changes: 1 addition & 1 deletion tests/tsgen/string.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("builtin string fields", () => {
"export interface BuiltinStrings
{
/** Version */
_version: 4 ;
_version?: 4 ;
title: string ;
single_line?: string ;
multi_line?: string ;
Expand Down
2 changes: 1 addition & 1 deletion tests/tsgen/taxonomies.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe("builtin taxonomies field", () => {
"export interface ITaxonomy
{
/** Version */
_version: 2 ;
_version?: 2 ;
title: string ;
boolean?: boolean ;
taxonomies?: ITaxonomy[] ;
Expand Down
Loading