question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[oas3] base64 vs byte

See original GitHub issue

The spec makes numerous references to {format: base64} (here and here for example). However this format is not defined in either the wright-00 JSON-schema spec, nor in the OAS3 defined data types.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
handrewscommented, Mar 5, 2020

In OAS 3.1, this can now be handled properly from the JSON Schema perspective. Specifically:

type: string
contentEncoding: base64

is a base64-endcode string (where base64 is per RFC 4648). You can use any RFC 4648 or RFC 2045 encoding, so base64url or quoted-printable are also valid.

If you are encoding a specific media type, such as a PNG file:

type: string
contentEncoding: base64
contentMediaType: image/png

Note that the content* keywords are informational, and are not validated during JSON Schema validation.

For binary transfer, use

type: string
contentMediaType: application/octet-stream

or some other media type.


we should probably deprecate "format": "base64" and "format": "binary" in OAS 3.1 although I don’t feel strongly about it. Well… I have lots of strong feelings about format but that’s a rant for another time.

2reactions
jwaltoncommented, Apr 23, 2018

FWIW, my vote is for base64. It much more clearly conveys the intent.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Data Types - Swagger
byte – base64-encoded characters, for example, U3dhZ2dlciByb2Nrcw== binary – binary data, used to describe files (see Files below). However, ...
Read more >
OpenAPI Specification v3.1.0 | Introduction, Definitions, & More
The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP APIs.
Read more >
Byte array versus Base 64 string in RESTful web service
The wonderful thing about a RESTful interface is that it's just HTTP. So if you expose the "byte array" version via REST, any...
Read more >
How to get PSN Account ID 8 bytes base64 - YouTube
Updated video : https://youtu.be/FxcSHJ2kEVA - How to get PSN Account ID 8 bytes base64 hello guys, in this video, i am explaining that...
Read more >
How Base64 Encoding Works - seoits.com is for sale
Base64 Encoding Logic Base64 encoding breaks binary data into 6-bit segments of 3 full bytes and represents those as printable characters in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found