Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/oeb25/abeye into openapi-3.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkeldenker committed Nov 19, 2024
2 parents 8b406a5 + 83b237f commit 5ef53a1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ fn operation(
todo!()
};
match media_type.as_str() {
"text/plain" => {
"text/plain" | "text/plain; charset=utf-8" => {
assert_eq!(ty, Type::new(db, TypeKind::String));
Some(ResponseKind::Plain)
}
Expand Down
5 changes: 4 additions & 1 deletion src/preamble.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars */

type Method = "DELETE" | "GET" | "PUT" | "POST" | "HEAD" | "TRACE" | "PATCH";

let GLOBAL_API_BASE = "";
Expand All @@ -9,13 +11,14 @@ export const setGlobalApiBase = (apiBase: string) =>
export type ApiOptions = {
fetch?: typeof fetch;
apiBase?: string;
headers?: Record<string, string>;
};

export const requestPlain = (
method: Method,
url: string,
body?: unknown,
options?: ApiOptions & { headers?: Record<string, string> }
options?: ApiOptions
): {
data: Promise<string>;
cancel: (reason?: string) => void;
Expand Down
9 changes: 6 additions & 3 deletions src/ts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,12 @@ impl Operation {
ResponseKind::Json(ty) => {
format!("requestJson<{}>({args})", ty.ts(db))
}
ResponseKind::EventStream(ty) => {
format!("sse<{}>({args})", ty.ts(db))
}
ResponseKind::EventStream(ty) => match ty.kind(db) {
TypeKind::Array(inner) => {
format!("sse<{}>({args})", inner.ts(db))
}
_ => format!("sse<{}>({args})", ty.ts(db)),
},
},
None => todo!(),
};
Expand Down

0 comments on commit 5ef53a1

Please sign in to comment.