Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions .github/workflows/dependabot-auto-merge.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.3, 8.2]
laravel: [11.*, 10.*]
laravel: [12.*, 11.*, 10.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 12.*
testbench: 10.*
carbon: ^3.0
- laravel: 11.*
testbench: 9.*
carbon: ^2.63
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
"require": {
"php": "^8.2",
"spatie/laravel-package-tools": "^1.16",
"illuminate/contracts": "^10.0||^11.0"
"illuminate/contracts": "^10.0||^11.0||^12.0"
},
"require-dev": {
"laravel/pint": "^1.14",
"nunomaduro/collision": "^8.1.1||^7.10.0",
"orchestra/testbench": "^9.0.0||^8.22.0",
"pestphp/pest": "^2.34",
"pestphp/pest-plugin-arch": "^2.7",
"pestphp/pest-plugin-laravel": "^2.3"
"nunomaduro/collision": "^8.7.0||^7.10.0",
"orchestra/testbench": "^8.0||^9.0||^10.0",
"pestphp/pest": "^2.3.4||^3.7.4",
"pestphp/pest-plugin-arch": "^2.7.0||^3.0.0",
"pestphp/pest-plugin-laravel": "^2.3.0||^3.1.0"
},
"autoload": {
"psr-4": {
Expand Down
36 changes: 28 additions & 8 deletions config/scalar.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
| affect the paths of its internal API that aren't exposed to users.
|
*/
'path' => '/reference',
'path' => '/scalar',

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -87,36 +87,48 @@
// 'saturn',
// 'solarized',
// 'none',

/** The layout to use for the references */
'layout' => 'modern',

/** URL to a request proxy for the API client */
'proxy' => 'https://proxy.scalar.com',
'proxyUrl' => 'https://proxy.scalar.com',

/** Whether to show the sidebar */
'showSidebar' => true,

/**
* Whether to show models in the sidebar, search, and content.
*/
'hideModels' => false,

/**
* Whether to show the “Download OpenAPI Document” button
*/
'hideDownloadButton' => false,

/**
* Whether to show the “Test Request” button
*/
'hideTestRequestButton' => false,

/**
* Whether to show the sidebar search bar
*/
'hideSearch' => false,

/** Whether dark mode is on or off initially (light mode) */
'darkMode' => false,

/** forceDarkModeState makes it always this state no matter what*/
'forceDarkModeState' => 'dark',

/** Whether to show the dark mode toggle */
'hideDarkModeToggle' => false,

/** Key used with CTRL/CMD to open the search modal (defaults to 'k' e.g. CMD+k) */
'searchHotKey' => 'k',

/**
* If used, passed data will be added to the HTML header
*
Expand All @@ -125,50 +137,58 @@
'metaData' => [
'title' => config('app.name').' API Reference',
],

/**
* Path to a favicon image
*
* @example '/favicon.svg'
*/
'favicon' => '',

/**
* List of httpsnippet clients to hide from the clients menu
* By default hides Unirest, pass `[]` to show all clients
*/
'hiddenClients' => [

],

/** Determine the HTTP client that’s selected by default */
'defaultHttpClient' => [
'targetId' => 'shell',
'clientKey' => 'curl',
],

/** Custom CSS to be added to the page */
'customCss' => '',
// 'customCss' => '',

/** Prefill authentication */
'authentication' => [
// TODO
],
// 'authentication' => [
// // TODO
// ],

/**
* The baseServerURL is used when the spec servers are relative paths and we are using SSR.
* On the client we can grab the window.location.origin but on the server we need
* to use this prop.
*/
'baseServerURL' => '',
// 'baseServerURL' => '',

/**
* List of servers to override the openapi spec servers
*/
'servers' => null,
// 'servers' => [
// [
// 'url' => 'https://api.scalar.com',
// 'description' => 'Production server',
// ],
// ],

/**
* We’re using Inter and JetBrains Mono as the default fonts. If you want to use your own fonts, set this to false.
*/
'withDefaultFonts' => true,

/**
* By default we only open the relevant tag based on the url, however if you want all the tags open by default then set this configuration option :)
*/
Expand Down
9 changes: 4 additions & 5 deletions resources/views/reference.blade.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
@extends('scalar::layout')

@section('content')
<script id="api-reference" data-url="{{ \Scalar\Scalar::url() }}"></script>
<div id="app"></div>

<script src="{{ \Scalar\Scalar::cdn() }}"></script>

<script>
document.getElementById('api-reference').dataset.configuration =
JSON.stringify({!! \Scalar\Scalar::configuration() !!})
Scalar.createApiReference('#app', {!! \Scalar\Scalar::configuration() !!})
</script>

<script src="{{ \Scalar\Scalar::cdn() }}"></script>
@endsection
1 change: 1 addition & 0 deletions src/Scalar.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public static function configuration()
/** Render as JSON */
return collect($configuration)->merge([
'theme' => $theme,
'url' => config('scalar.url'),
]);
}
}
8 changes: 4 additions & 4 deletions tests/ScalarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
$response = $this->get(config('scalar.path'));

$response->assertOk()
->assertSee('data-url')
->assertSee(config('scalar.url'));
->assertSee('Scalar.createApiReference')
->assertSee(str_replace('/', '\/', config('scalar.url')));
});

it('contains the jsDelivr URL', function () {
$response = $this->get(config('scalar.path'));

$response->assertOk()
->assertSee('https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.json');
->assertSee('https:\/\/cdn.jsdelivr.net\/npm\/@scalar\/galaxy\/dist\/latest.json');
});

it('reflects changes in the config', function () {
Expand All @@ -41,7 +41,7 @@
// Modify config
config()->set('scalar.cdn', 'https://example.com/cdn');

$response = $this->get('/reference');
$response = $this->get('/scalar');

$response->assertOk()
->assertSee('https://example.com/cdn')
Expand Down