Code Monkey home page Code Monkey logo

Comments (1)

Blankeos avatar Blankeos commented on May 27, 2024

✅ Solved

Closing this since it's a duplicate of #907

Someone actually already answered it: #907 (comment). I wasn't able to make it work at first because I was on Windows but running a .sh file. Which means it's actually still using the Linux/Mac bash syntax. That means I could've been using export instead of set when inside a bash file.

I've also updated my shell script like so:

# scripts/openapi-generate.sh

PUBLIC_API_URL=$(dotenv -p PUBLIC_API_URL)

# Arg$1: The public api url.
if [ -z "$PUBLIC_API_URL" ]; then
 echo "Please specify PUBLIC_API_URL in the .env file."
 exit 1
fi

echo "🔑 Disabling NODE_TLS_REJECT_UNAUTHORIZED to allow introspecting HTTPS API."
export NODE_TLS_REJECT_UNAUTHORIZED=0

openapi-typescript $PUBLIC_API_URL -o src/lib/types/openapi.d.ts
// package.json

{
	"name": "my-app",
	"scripts": {
		"generate": "sh scripts/openapi-generate.sh"
	}
	"devDependencies": {
		"dotenv-cli": "^7.3.0"
	}
}

Result:
image

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.