fix: rename ResourceType -> Resource

This commit is contained in:
Ruben Fiszel
2022-06-14 08:55:55 +02:00
parent c0838c6998
commit a8d1e703e1
4 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -3122,10 +3122,10 @@ components:
enum: ["str", "float", "int", "bool", "unknown"]
- type: object
properties:
resourcetype:
resource:
type: string
required:
- resourcetype
- resource
has_default:
type: boolean
default: {}
+3 -3
View File
@@ -36,7 +36,7 @@ pub enum Typ {
List,
Bytes,
Datetime,
ResourceType(String),
Resource(String),
Unknown,
}
@@ -254,7 +254,7 @@ fn binding_ident_to_arg(
TsEntityName::TsQualifiedName(p) => &*p.right.sym,
};
match sym.to_string().as_str() {
"ResourceType" => Typ::ResourceType(
"Resource" => Typ::Resource(
type_params
.as_ref()
.and_then(|x| {
@@ -755,7 +755,7 @@ def main():
let code = "
export function main(test1: string, test2: string = \"burkina\",
test3: wmill.ResourceType<'rt'>, email: email_string) {
test3: wmill.Resource<'postgres'>, email: email_string) {
console.log(42)
}
+1 -1
View File
@@ -10,7 +10,7 @@ export {
export type string_regex<S extends string> = String
export type string_email = String
export type ResourceType<S extends string> = {}
export type Resource<S extends string> = {}
/**
* Create a client configuration from env variables
+3 -3
View File
@@ -44,7 +44,7 @@ export async function inferArgs(
}
}
function argSigToJsonSchemaType(t: string | { resourcetype: string }, s: SchemaProperty): void {
function argSigToJsonSchemaType(t: string | { resource: string }, s: SchemaProperty): void {
if (t === 'int') {
s.type = 'integer'
} else if (t === 'float') {
@@ -63,9 +63,9 @@ function argSigToJsonSchemaType(t: string | { resourcetype: string }, s: SchemaP
} else if (t === 'datetime') {
s.type = 'string'
s.format = 'date-time'
} else if (typeof t !== 'string' && t.resourcetype != undefined) {
} else if (typeof t !== 'string' && t.resource != undefined) {
s.type = 'object'
s.format = `resource-${t.resourcetype}`
s.format = `resource-${t.resource}`
} else {
s.type = undefined
}