Skip to content

Commit f38d895

Browse files
committed
fix: add missing schema keys
1 parent f44f742 commit f38d895

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

packages/provider-generator/src/schema.ts

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
export type AttributeType = 'bool' | 'number' | 'string' | unknown[];
1+
/**
2+
* https://developer.hashicorp.com/terraform/language/expressions/type-constraints
3+
*/
4+
export type PrimitiveType = 'string' | 'number' | 'bool';
5+
export type CollectionType = 'list' | 'map' | 'set';
6+
export type StructuralType = 'object' | 'tuple';
7+
8+
export type AttributeType =
9+
| PrimitiveType
10+
| [CollectionType, PrimitiveType]
11+
| [CollectionType, [StructuralType, { [key: string]: AttributeType }]];
212

313
export interface Attribute {
414
/**
@@ -8,6 +18,7 @@ export interface Attribute {
818
*/
919
type: AttributeType;
1020
description?: string;
21+
description_kind?: 'markdown' | 'plain';
1122
/**
1223
* If attribute is marked as optional, then it should be optional in the interface.
1324
*/
@@ -20,6 +31,8 @@ export interface Attribute {
2031
* If the attribute is required, then it should be required in the interface.
2132
*/
2233
required?: boolean;
34+
sensitive?: boolean;
35+
deprecated?: boolean;
2336
}
2437

2538
/**
@@ -28,20 +41,22 @@ export interface Attribute {
2841
* jq '[.. | objects | select(has("nesting_mode")) | {nesting_mode, min_items, max_items}] | unique' google/schema.json
2942
*/
3043
export interface BlockType {
31-
nesting_mode: 'single' | 'list' | 'set';
44+
nesting_mode: 'list' | 'set' | 'single';
3245
block: Block;
3346
min_items?: number;
3447
max_items?: number;
3548
}
3649

3750
export interface Block {
38-
description?: string;
3951
attributes?: {
4052
[key: string]: Attribute;
4153
};
4254
block_types?: {
4355
[key: string]: BlockType;
4456
};
57+
description?: string;
58+
description_kind?: 'markdown' | 'plain';
59+
deprecated?: boolean;
4560
}
4661

4762
/**
@@ -52,14 +67,30 @@ export interface ProviderSchema {
5267
block: Block;
5368
};
5469
resource_schemas: {
55-
[resource: string]: {
70+
[resource_name: string]: {
5671
block: Block;
5772
};
5873
};
59-
data_source_schemas: {
60-
[resource: string]: {
74+
data_source_schemas?: {
75+
[resource_name: string]: {
6176
block: Block;
6277
};
6378
};
64-
functions?: Record<string, any>;
79+
ephemeral_resource_schemas?: {
80+
[resource_name: string]: {
81+
block: Block;
82+
};
83+
};
84+
functions?: {
85+
[function_name: string]: {
86+
description?: string;
87+
summary?: string;
88+
return_type?: string;
89+
parameters?: {
90+
name: string;
91+
description?: string;
92+
type: string;
93+
}[];
94+
};
95+
};
6596
}

0 commit comments

Comments
 (0)