- Routes now support deep linking by clicking on the Route's URL path to copy the route and hashed url and query params to clipboard.
- Custom Body / Querystring params can be added that aren't specified by the Route Definition.
- When multiple Workspaces are active, routes are grouped by Workspace on the sidebar and sidebar workspaces can be collapsed.
- Since HistoricResponses can now be preloaded in v0.0.36, the active workspace isn't determined when a route is clicked anymore, but inferred by matching on the Route name. Since Route name isn't guaranteed to be unique, this commit changes to the Route's url path which is less likely to have collisions.
- When a route is active, it will now preload the last Request/Response (HistoricResponse) into the form fields
- When a route is active and you change the form fields, when you leave the route and come back, the changes persist until the page is closed/refreshed.
- Ability to Load a previous request/response to replay it
- Instead of needing to
import {Method} from "badmagic";
and specifyMethod.POST
, changed types so that"POST"
will work instead. This works for GET, POST, PATCH, PUT, and DELETE. Note: It currently won't display errors via TS if something invalid is specified (There is probably a better way to handle this).
- Adds ability to copy Request Body and API Error Response to clipboard
- Adds ability to copy API Response to clipboard
- Toggle added to Select All / Deselect All workspaces
- If your param's placeholder is an ISO timestamp, a date or a time, a
NOW
button shows up to the right of the input and populates the input with the current UTC value when clicked - Under the config menu there is a new
Hide Deprecated Routes
option to filter out routes that are deprecated when applied
- Upgrade
react-markdown
to ^7
- Upgrade
@smartrent/use-axios
to 2.0.0
Note: v0.0.29 had a dependency bug with @smartrent/use-axios
, please use v0.0.30
v0.0.29 is a partial rewrite of badmagic
with significant changes to the implementation. It's designed to be
easier to implement and reduced complexity with hooking into axios
by using it's interceptor
. See README
for
example usage.
There's likely additional work that needs to be done in future versions with css styles and potentially bugfixes from the rewrite.
- Adds new
History
section to see previous api requests and responses - Simplifies implementation and simplifies badmagic codebase
- Adds support for
applyAxiosInterceptors
,AuthForm
(which renders above theRoute
component), andHistoryMetadata
(which renders at the bottom of eachHistoricRecord
component)
There are a lot of breaking changes in this version upgrade. A few of the major ones are listed below, but
refer to the README
to see how usage guidelines and examples.
- Removes the
plugins
system. SeeReadme
for information on how to convert fromplugins
to usingAuthForm
andapplyAxiosInterceptors
- Removes the
EnvVar
system. It wasn't being used except for Auth Profiles which are now handled outside of BadMagic through interceptors - Removes support for
sticky
attribute on a route - Removes most of the exports from
badmagic
includingLayout
,Theme
,ContextProvider
,Workspaces
andWorkspace
- Request param values are no longer stored in local storage
- Ensure Workspace selected before initializing routes in local storage. Fixes bug where application would freeze if no workspace selected
- Improved TS definitions
- Cleanup TypeScript definitions when the plugin system is being used so TS errors aren't thrown
- If a
Param
has adescription
, it will render an info question mark to help provide more information to the end-user. - A previous version added support for
nullable: true
for the OpenAPI spec when downloading JSON. Now the badmagic UI respects that and won't show theNull
button if a field can't be nullable - Before a network request is submitted by the end user, badmagic now validates that the
URL Params
all have values usingYup
. If they don't the request fails with validation errors. Note: We are planning on adding support for validatingbody
params in the future but for now, even though they can be marked as required and the red asterisk shows up, badmagic will allow the network request to continue.
- URL Params are always required but a previous iteration caused URL Params to lose the red asterisk indicating it was required. This has been added back.
- New routes weren't showing up if local storage wasn't cleared for that workspace (presumed fixed in 0.0.24 but there were instances where this was still occurring). Workspace initialization (including all of a workspace's routes) has been moved to Workspace.tsx from Route.tsx. The problem was that we were writing to localstorage asynchronously so sometimes routes that were being initialized were clobbering other routes that has been just saved to local storage, causing them not to render. This also should improve performance because Route.tsx should generally have less re-renders.
- Improved Typescript specifications in many areas
- Misc. cleanup on components to break them apart more
- Uses
useMemo
anduseCallback
in a few areas to improve performance
- If
deprecated: true
is specified for a route, it will show a deprecated tag in the UI for that route - Autocollapse portions of large json response to improve rendering performance
- New routes weren't showing up if local storage wasn't cleared for that workspace
- Select dropdowns were inadvertently changed to text inputs
- Adds array support for a Param by specifying
{array: true}
in the options
defaultValue
is now of typeany
from typestring
- Allow falsy values in query string (values are omitted if they are undefined)
- Upgrades
axios
to0.21.1
to patch a security vulnerability
- Adds
useGlobalContext
as well asOpenApi
to exports - Adds support for
Download OpenApi
json- If OpenApi specs are not passed in, OpenApi JSON is derived from the workspace information. Note: Badmagic cannot derive responses
- Fixes a bug where if
setEnvVar
was called twice in a row, the first set of changes would be lost - Fixes a bug where new routes were showing
0
in the response section
- Adds
Jest
for testability - Adds more Typescript strictness by reducing implicit anys
- Misc UI cleanup
- Added a button to explicitly set request param values to
null
- Added a preview of the request body
- Clearing a param value removes it from the request instead of setting the value to
null
(#26) - Headers render with a light font color in dark mode
- Fix clicking on tab such as
Documentation
scrolling to the top of the page
- If you have a dropdown option with a value of
false
it would revert to theSelect One
option (if that existed). Nowfalse
is handled appropriately and we just check againstnull
orundefined
for reverting back toSelect One
Documentation
tab now requireshtml
generated by the webpackmarkdown-loader
(usually passed through thehtml-loader
) whereas before it would take a JS template string that had markdown inside and parse that string
- Keyword search is workspace specific now
- Better object params support: specifying a key of
properties
will infer that the param is an object (see example below) - A route can have
sticky: true
added to it so that it cannot be filtered with keyword search Documentation
tab is hidden if there is no documentation specified- Environment variables previously needed to be saved through click of a button, we've removed the button in favor of using the Enter key
{
name: "Create User",
path: "/v1/users",
method: "POST",
body: [
{
name: "user",
label: "User",
properties: [
{ name: "first_name", required: true },
{ name: "last_name", required: true },
{ name: "email", required: true },
{ name: "dob", type: "date" },
],
},
]
}
- Context no longer has support for
setRouteFilter
androuteFilter
since it's now namespaced to a workspace. Please usesetWorkspaceSearchKeywords(keywords)
andgetWorkspaceSearchKeywords()
instead
- We are going to deprecate
json
as a param option in a future version in favor of a param that hasproperties
. We will probably need to do something to have stronger array support so we will leavejson
for now
- Mark URL Params as required (note: it will not enforce this currently)
- If there are no QS params, do not include
?
in the request - Handle non-json Axios 200 responses and non-json error responses
- Add new
documentation
key to routes to provide Markdown documentation to your end-users
- Style refactor using TailwindCSS
- Dark Mode
- Fixed header for workspaces, search, and env
- Adds ReactJsonView for responses
- Routes collapsed by default
- Inputs have
Set Null
button - Routes have a reset form button
- Improve Route / Request Spacing
- Default values are now applied without requiring a keystroke