Skip to content

Commit

Permalink
Merge pull request #78 from Contentstack-Solutions/staging
Browse files Browse the repository at this point in the history
Merge staging to master
  • Loading branch information
aman19K authored Jan 12, 2024
2 parents c825c9a + a22b876 commit d8d4872
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Contentstack Solutions
Copyright (c) 2024 Contentstack Solutions

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 5 additions & 5 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.2.1",
"version": "2.2.2",
"author": "Michael Davis",
"bugs": "https://github.com/Contentstack-Solutions/contentstack-cli-tsgen/issues",
"dependencies": {
Expand Down
9 changes: 2 additions & 7 deletions src/lib/stack/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ export type Field = GlobalField &
ReferenceField &
GroupField &
EnumField &
BlockField &
{ field_metadata: FieldMetaData };
BlockField
export type Schema = Array<Field>;

export type ContentType = {
Expand All @@ -63,8 +62,4 @@ export type ContentType = {
reference_to?: string;
data_type?: string;
schema_type?: string;
} & Identifier;

export type FieldMetaData = {
ref_multiple?: boolean;
}
} & Identifier;
2 changes: 1 addition & 1 deletion src/lib/tsgen/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export default function (userOptions: TSGenOptions) {
references.push(name_type(field.reference_to))
}

return ['(', references.join(' | '), ')', field.field_metadata?.ref_multiple ? '[]' : ''].join('')
return ["(", references.join(" | "), ")", "[]"].join("");
}

return function (contentType: ContentstackTypes.ContentType): TSGenResult|any {
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 @@ -29,7 +29,7 @@ describe("references", () => {
version: 5 ;
title: string ;
url: string ;
single_reference: (IReferenceChild) ;
single_reference: (IReferenceChild)[] ;
multiple_reference?: (IReferenceChild | IBoolean | IBuiltinExample)[] ;
}"
`);
Expand Down

0 comments on commit d8d4872

Please sign in to comment.