Skip to content

Commit

Permalink
fix: rename ResourceType -> Resource
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenfiszel committed Jun 14, 2022
1 parent e127d2f commit 28b5671
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions backend/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}
Expand Down
6 changes: 3 additions & 3 deletions backend/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub enum Typ {
List,
Bytes,
Datetime,
ResourceType(String),
Resource(String),
Unknown,
}

Expand Down Expand Up @@ -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| {
Expand Down Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion deno-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/infer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand All @@ -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
}
Expand Down

0 comments on commit 28b5671

Please sign in to comment.