Giter VIP home page Giter VIP logo

Comments (3)

drwpow avatar drwpow commented on May 28, 2024 1

I can figure out a workaround unless you'd prefer I open an issue in Redocly.

No workarounds are fine. Honestly a lot of the delay of 7.x stable being released is filing down some sharp edges with Redocly. I’m glad to be using it—it offloads a ton of complexity I think it’s far better at than this library ever was—but it comes with drawbacks like this.

They're effectively no longer "testing" that a given string is a ref e.g. #/components/ anymore because they removed the / from the split.

Ah great catch! On the one hand, yeah this would be easy for them to test in some way. On the other, testing is hard 😅. Either way, I think having the fix live in this repo (and having a test for it) is smart.

from openapi-typescript.

drwpow avatar drwpow commented on May 28, 2024

Ah great catch. I don’t remember having tests for # characters specifically in an operationId, but it’d be great to ensure this works.

Not sure whether this was introduced with Redocly’s schema bundling, or just a net-new bug in 7.x. But either way seems like the # character is probably being parsed incorrectly (e.g. $ref: "#/components/schemas/foo").

Would love a PR for this if you (or anyone else) is able!

from openapi-typescript.

jaredLunde avatar jaredLunde commented on May 28, 2024

Digging in right now. Looks maybe related to this change: Redocly/redocly-cli@4ab6e09#diff-25c0338c90db3454ba7548187ad0db4e1e288ffca3c1d6ef65f45a442e728074

I can figure out a workaround unless you'd prefer I open an issue in Redocly.

edit:
Yeah if i move the parseRef function they were using for 2 years into your ts.ts and use that one instead, the test I wrote passes. They're effectively no longer "testing" that a given string is a ref e.g. #/components/ anymore because they removed the / from the split.

export function parseRef(ref: string): {
  uri: string | null;
  pointer: string[];
} {
  const [uri, pointer] = ref.split("#/");
  return {
    uri: uri || null,
    pointer: pointer
      ? pointer.split("/").map(unescapePointer).filter(isTruthy)
      : [],
  };
}

from openapi-typescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.