fa0311 / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
2 stars 0 forks source link

Note #1

Open fa0311 opened 1 year ago

fa0311 commented 1 year ago

install

./mvnw clean install

build and update sample

mvn package -DskipTests &&  ./bin/generate-samples.sh
# ./bin/generate-samples.sh ./bin/configs/*.yaml

test

cd samples/openapi3/client/petstore/<lang>
pytest -v
# mvn integration-test -e # or make test-all
cd samples/client/echo_api/<lang>
pip install -r requirements.txt && pip install -r test-requirements.txt 
python3 -m pytest

windows all build

$data = Get-ChildItem ".\bin\configs\*yaml" | Resolve-Path -Relative
$config = $data -join " "
$cmd = "java -jar .\..\openapi-generator-cli.jar batch --fail-fast  -- $config"
Invoke-Expression $cmd
fa0311 commented 12 months ago

https://qiita.com/fsdg-adachi_h/items/4d11e94a2389758759cd

fa0311 commented 12 months ago

python test

sudo apt install python3-virtualenv
fa0311 commented 11 months ago

sudo apt install nginx

sudo vi /etc/nginx/nginx.conf

- 60     include /etc/nginx/sites-enabled/*;
+ 60     # include /etc/nginx/sites-enabled/*;

sudo vi /etc/nginx/conf.d/pet_store.conf

server {
    listen       80;
    server_name  localhost;

    location / {
      proxy_pass http://petstore.swagger.io/v2/;
    }
}

sudo systemctl restart nginx sudo service nginx restart

fa0311 commented 11 months ago

apt install nodejs npm

git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server cd http-echo-server npm install nodejs index.js

fa0311 commented 11 months ago
# flake8.sh

flake8 --exclude petstore_api/*.py

black petstore_api/models/*.py -l 79
black petstore_api/api/*.py -l 79
# autopep8 --in-place --aggressive --aggressive petstore_api/models/*.py
# autopep8 --in-place --aggressive --aggressive petstore_api/api/*.py

flake8 --exclude petstore_api/**/*.py, petstore_api/*.py

mypy petstore_api/api/*.py
mypy petstore_api/models/*.py
fa0311 commented 5 months ago

python/**/*.mustache, AbstractPythonCodegen.java,tests/*.py, tests/*.py, python/*.yaml, Codegen*.java src/test/resources/3_0/python/*.yaml

fa0311 commented 3 months ago
git clone https://github.com/swagger-api/swagger-petstore
cd swagger-petstore
git checkout v2
vi  pom.xml
- 93      <port>8002</port>
+ 93     <port>3000</port>
mvn package jetty:run