Skip to content

Conversation

@Hajime-san
Copy link

closes #7442

Importing example from OpenAPI3 document needs this feature.

type Value,
} from "../core/types.js";
import { getEncode, resolveEncodedName, type EncodeData } from "./decorators.js";
import { uint8ArrayToBase64 } from "./Uint8ArrayBase64Polyfill.js";
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't want to copy and paste the polyfill, I can also install a polyfill library.

* const bytes = bytes.fromString("TypeSpec");
* ```
*/
init fromString(value: string);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we have this constructor it should be more explicit on what is the string(include the encoding)

cc @witemple-msft what do you think? this also could be a good use case for a parameterized constructor

[
{
value: `bytes.fromString("hello⛳❤️🧀")`,
expect: "hello⛳❤️🧀",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would also not be correct, by default bytes are serialized as base64 in json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support examples for bytes

2 participants