INNER CODE UNIT · JavaScript

setup

walmartlabs/json-to-simple-graphql-schema · web-ui/index.js:4

const setup = () => {
  const jsonTextarea = document.getElementById("json");
  const graphqlTextarea = document.getElementById("graphql");

  const setGraphQLResult = () => {
    if (!jsonTextarea.value) {
      graphqlTextarea.value = "";
      return;
    }

    try {
      const jsonObject = JSON.parse(jsonTextarea.value);
      jsonTextarea.value = JSON.stringify(jsonObject, null, 2);
      jsonTextarea.classList.remove("invalid");

      const schema = jsonToSchema({ jsonInput: jsonTextarea.value });
      graphqlTextarea.value = schema.value;
    } catch (error) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…