wrap-cli icon indicating copy to clipboard operation
wrap-cli copied to clipboard

Improved JS Bindings (language-native type names)

Open dOrgJelli opened this issue 2 years ago • 0 comments

Describe the bug Currently our codegen for JS is not very user friendly to JS-native developers. This is because we define types using Polywrap-specific schema naming conventions. Consider the following example:

export interface Http_Request {
  headers?: Map<Types.String, Types.String> | null;
  urlParams?: Map<Types.String, Types.String> | null;
  responseType: Types.Http_ResponseType;
  body?: Types.String | null;
  formData?: Array<Types.Http_FormDataEntry> | null;
  timeout?: Types.UInt32 | null;
}

A more JS-native interface would look like the following:

export interface Http_Request {
  headers?: Map<string, string> | null;
  urlParams?: Map<string, string> | null;
  responseType: Http.ResponseType;
  body?: string | null;
  formData?: Array<Http.FormDataEntry> | null;
  timeout?: u32 | null;
}

dOrgJelli avatar Mar 09 '23 20:03 dOrgJelli