Skip to content

Commit 9a6f14a

Browse files
authored
Add workflow to test Crystal client (#22477)
* add workflow to test crystal client * update * shards install * fix * use localhost
1 parent 2d3082a commit 9a6f14a

File tree

4 files changed

+43
-4
lines changed

4 files changed

+43
-4
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Samples Crystal clients
2+
3+
on:
4+
push:
5+
paths:
6+
- samples/client/petstore/crystal/**
7+
pull_request:
8+
paths:
9+
- samples/client/petstore/crystal/**
10+
jobs:
11+
build:
12+
name: Build Crystal projects
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
sample:
18+
# clients
19+
- samples/client/petstore/crystal/
20+
services:
21+
petstore-api:
22+
image: swaggerapi/petstore
23+
ports:
24+
- 80:8080
25+
env:
26+
SWAGGER_HOST: http://petstore.swagger.io
27+
SWAGGER_BASE_PATH: /v2
28+
steps:
29+
- uses: actions/checkout@v5
30+
- name: Install Crystal
31+
uses: crystal-lang/install-crystal@v1
32+
- name: Shards Install
33+
run: shards install
34+
working-directory: ${{ matrix.sample }}
35+
- name: Run tests
36+
run: crystal spec
37+
working-directory: ${{ matrix.sample }}

modules/openapi-generator/src/test/resources/3_0/crystal/petstore.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
openapi: 3.0.0
22
servers:
3-
- url: 'http://petstore.swagger.io/v2'
3+
- url: 'http://localhost/v2'
44
info:
55
description: >-
66
This is a sample server Petstore server. For this sample, you can use the api key
@@ -636,7 +636,7 @@ components:
636636
type: oauth2
637637
flows:
638638
implicit:
639-
authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
639+
authorizationUrl: 'http://localhost/api/oauth/dialog'
640640
scopes:
641641
'write:pets': modify pets in your account
642642
'read:pets': read your pets

samples/client/petstore/crystal/.openapi-generator-ignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@
2121
#docs/*.md
2222
# Then explicitly reverse the ignore rule for a single file:
2323
#!docs/README.md
24+
#
25+
#

samples/client/petstore/crystal/src/petstore/configuration.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ module Petstore
130130
# Create a new `Configuration`.
131131
def initialize
132132
@scheme = "http"
133-
@host = "petstore.swagger.io"
133+
@host = "localhost"
134134
@base_path = "/v2"
135135
@server_index = 0
136136
@server_operation_index = {} of Symbol => String
@@ -237,7 +237,7 @@ module Petstore
237237
def server_settings
238238
[
239239
{
240-
url: "http://petstore.swagger.io/v2",
240+
url: "http://localhost/v2",
241241
description: "No description provided",
242242
}
243243
]

0 commit comments

Comments
 (0)