Browse Source

Merge pull request #2450 from f4exb/fix-swagger

Fix swagger
chirpmodem-v8.0.0
Edouard Griffiths 2 years ago committed by GitHub
parent
commit
f7b9727ef9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      sdrbase/resources/webapi.qrc
  2. 13
      sdrbase/resources/webapi/doc/html2/index.html
  3. 16
      sdrbase/resources/webapi/doc/swagger-ui/index.css
  4. 25
      sdrbase/resources/webapi/doc/swagger-ui/index.html
  5. 37
      sdrbase/resources/webapi/doc/swagger-ui/oauth2-redirect.html
  6. 20
      sdrbase/resources/webapi/doc/swagger-ui/swagger-initializer.js
  7. 3
      sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-bundle.js
  8. 2
      sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-bundle.js.map
  9. 2
      sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-es-bundle-core.js
  10. 2
      sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-es-bundle-core.js.map
  11. 3
      sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-es-bundle.js
  12. 2
      sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-es-bundle.js.map
  13. 3
      sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-standalone-preset.js
  14. 2
      sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-standalone-preset.js.map
  15. 3
      sdrbase/resources/webapi/doc/swagger-ui/swagger-ui.css
  16. 2
      sdrbase/resources/webapi/doc/swagger-ui/swagger-ui.css.map
  17. 3
      sdrbase/resources/webapi/doc/swagger-ui/swagger-ui.js
  18. 2
      sdrbase/resources/webapi/doc/swagger-ui/swagger-ui.js.map
  19. 5
      sdrbase/resources/webapi/doc/swagger/include/DemodAnalyzer.yaml
  20. 5
      sdrbase/resources/webapi/doc/swagger/include/MorseDecoder.yaml
  21. 4
      sdrbase/resources/webapi/doc/swagger/include/RemoteOutput.yaml
  22. 2
      sdrbase/resources/webapi/doc/swagger/include/WDSPRx.yaml
  23. 4
      sdrbase/resources/webapi/doc/swagger/swagger.yaml
  24. 12
      swagger/docker/compose/compose.yml
  25. 10
      swagger/docker/readme.md
  26. 5
      swagger/sdrangel/api/swagger/include/DemodAnalyzer.yaml
  27. 5
      swagger/sdrangel/api/swagger/include/MorseDecoder.yaml
  28. 4
      swagger/sdrangel/api/swagger/include/RemoteOutput.yaml
  29. 2
      swagger/sdrangel/api/swagger/include/WDSPRx.yaml
  30. 4
      swagger/sdrangel/api/swagger/swagger.yaml
  31. 13
      swagger/sdrangel/code/html2/index.html

3
sdrbase/resources/webapi.qrc

@ -135,10 +135,12 @@ @@ -135,10 +135,12 @@
<file>webapi/doc/swagger/include/VORLocalizer.yaml</file>
<file>webapi/doc/swagger/include/WFMDemod.yaml</file>
<file>webapi/doc/swagger/include/WFMMod.yaml</file>
<file>webapi/doc/swagger/include/WDSPRx.yaml</file>
<file>webapi/doc/swagger/include/Xtrx.yaml</file>
<file>webapi/doc/swagger-ui/favicon-16x16.png</file>
<file>webapi/doc/swagger-ui/favicon-32x32.png</file>
<file>webapi/doc/swagger-ui/index.html</file>
<file>webapi/doc/swagger-ui/index.css</file>
<file>webapi/doc/swagger-ui/oauth2-redirect.html</file>
<file>webapi/doc/swagger-ui/swagger-ui-bundle.js</file>
<file>webapi/doc/swagger-ui/swagger-ui-bundle.js.map</file>
@ -148,6 +150,7 @@ @@ -148,6 +150,7 @@
<file>webapi/doc/swagger-ui/swagger-ui-es-bundle.js.map</file>
<file>webapi/doc/swagger-ui/swagger-ui-standalone-preset.js.map</file>
<file>webapi/doc/swagger-ui/swagger-ui-standalone-preset.js</file>
<file>webapi/doc/swagger-ui/swagger-initializer.js</file>
<file>webapi/doc/swagger-ui/swagger-ui.css</file>
<file>webapi/doc/swagger-ui/swagger-ui.css.map</file>
<file>webapi/doc/swagger-ui/swagger-ui.js</file>

13
sdrbase/resources/webapi/doc/html2/index.html

@ -5530,6 +5530,7 @@ margin-bottom: 20px; @@ -5530,6 +5530,7 @@ margin-bottom: 20px;
"description" : "List of DV serial devices available in the system"
};
defs.DemodAnalyzerActions = {
"required" : [ "channelId", "deviceId" ],
"properties" : {
"deviceId" : {
"type" : "integer",
@ -10587,6 +10588,7 @@ margin-bottom: 20px; @@ -10587,6 +10588,7 @@ margin-bottom: 20px;
"description" : "MetisMISOSettings"
};
defs.MorseDecoderActions = {
"required" : [ "channelId", "deviceId" ],
"properties" : {
"deviceId" : {
"type" : "integer",
@ -13257,10 +13259,12 @@ margin-bottom: 20px; @@ -13257,10 +13259,12 @@ margin-bottom: 20px;
"type" : "integer"
},
"deviceIndex" : {
"type" : "integer"
"type" : "integer",
"description" : "remote SDRangel instance deviceset index"
},
"channelIndex" : {
"type" : "integer"
"type" : "integer",
"description" : "remote SDRangel instance channel index"
},
"useReverseAPI" : {
"type" : "integer",
@ -17230,7 +17234,8 @@ margin-bottom: 20px; @@ -17230,7 +17234,8 @@ margin-bottom: 20px;
},
"nbLeadTime" : {
"type" : "number",
"format" : "float"
"format" : "float",
"description" : "Advance time (s)"
},
"nbLagTime" : {
"type" : "number",
@ -59472,7 +59477,7 @@ except ApiException as e: @@ -59472,7 +59477,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2025-05-03T17:59:40.379+02:00
Generated 2025-05-29T12:27:25.321+02:00
</div>
</div>
</div>

16
sdrbase/resources/webapi/doc/swagger-ui/index.css

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body {
margin: 0;
background: #fafafa;
}

25
sdrbase/resources/webapi/doc/swagger-ui/index.html

@ -4,35 +4,14 @@ @@ -4,35 +4,14 @@
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
<link rel="stylesheet" type="text/css" href="index.css" />
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after
{
box-sizing: inherit;
}
body
{
margin:0;
background: #fafafa;
}
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
<script>

37
sdrbase/resources/webapi/doc/swagger-ui/oauth2-redirect.html

@ -4,8 +4,6 @@ @@ -4,8 +4,6 @@
<title>Swagger UI: OAuth2 Redirect</title>
</head>
<body>
</body>
</html>
<script>
'use strict';
function run () {
@ -15,31 +13,32 @@ @@ -15,31 +13,32 @@
var isValid, qp, arr;
if (/code|token|error/.test(window.location.hash)) {
qp = window.location.hash.substring(1);
qp = window.location.hash.substring(1).replace('?', '&');
} else {
qp = location.search.substring(1);
}
arr = qp.split("&")
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';})
arr = qp.split("&");
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
qp = qp ? JSON.parse('{' + arr.join() + '}',
function (key, value) {
return key === "" ? value : decodeURIComponent(value)
return key === "" ? value : decodeURIComponent(value);
}
) : {}
) : {};
isValid = qp.state === sentState
isValid = qp.state === sentState;
if ((
oauth2.auth.schema.get("flow") === "accessCode"||
oauth2.auth.schema.get("flow") === "authorizationCode"
oauth2.auth.schema.get("flow") === "accessCode" ||
oauth2.auth.schema.get("flow") === "authorizationCode" ||
oauth2.auth.schema.get("flow") === "authorization_code"
) && !oauth2.auth.code) {
if (!isValid) {
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "warning",
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
});
}
@ -48,7 +47,7 @@ @@ -48,7 +47,7 @@
oauth2.auth.code = qp.code;
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
} else {
let oauthErrorMsg
let oauthErrorMsg;
if (qp.error) {
oauthErrorMsg = "["+qp.error+"]: " +
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
@ -59,7 +58,7 @@ @@ -59,7 +58,7 @@
authId: oauth2.auth.name,
source: "auth",
level: "error",
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server."
});
}
} else {
@ -68,7 +67,13 @@ @@ -68,7 +67,13 @@
window.close();
}
window.addEventListener('DOMContentLoaded', function () {
run();
});
if (document.readyState !== 'loading') {
run();
} else {
document.addEventListener('DOMContentLoaded', function () {
run();
});
}
</script>
</body>
</html>

20
sdrbase/resources/webapi/doc/swagger-ui/swagger-initializer.js

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
window.onload = function() {
//<editor-fold desc="Changeable Configuration Block">
// the following lines will be replaced by docker/configurator, when it runs in a docker-container
window.ui = SwaggerUIBundle({
url: "https://petstore.swagger.io/v2/swagger.json",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
});
//</editor-fold>
};

3
sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-bundle.js

File diff suppressed because one or more lines are too long

2
sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-bundle.js.map

File diff suppressed because one or more lines are too long

2
sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-es-bundle-core.js

File diff suppressed because one or more lines are too long

2
sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-es-bundle-core.js.map

File diff suppressed because one or more lines are too long

3
sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-es-bundle.js

File diff suppressed because one or more lines are too long

2
sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-es-bundle.js.map

File diff suppressed because one or more lines are too long

3
sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-standalone-preset.js

File diff suppressed because one or more lines are too long

2
sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-standalone-preset.js.map

File diff suppressed because one or more lines are too long

3
sdrbase/resources/webapi/doc/swagger-ui/swagger-ui.css

File diff suppressed because one or more lines are too long

2
sdrbase/resources/webapi/doc/swagger-ui/swagger-ui.css.map

File diff suppressed because one or more lines are too long

3
sdrbase/resources/webapi/doc/swagger-ui/swagger-ui.js

File diff suppressed because one or more lines are too long

2
sdrbase/resources/webapi/doc/swagger-ui/swagger-ui.js.map

File diff suppressed because one or more lines are too long

5
sdrbase/resources/webapi/doc/swagger/include/DemodAnalyzer.yaml

@ -42,12 +42,13 @@ DemodAnalyzerSettings: @@ -42,12 +42,13 @@ DemodAnalyzerSettings:
DemodAnalyzerActions:
description: "Demod Analyzer actions"
required:
- deviceId
- channelId
properties:
deviceId:
type: integer
required: true
description: "Device Id/Number that channel belongs to"
channelId:
type: integer
required: true
description: "Channel Id/Number of the channel within the device"

5
sdrbase/resources/webapi/doc/swagger/include/MorseDecoder.yaml

@ -59,12 +59,13 @@ MorseDecoderSettings: @@ -59,12 +59,13 @@ MorseDecoderSettings:
MorseDecoderActions:
description: "Morse Decoder actions"
required:
- deviceId
- channelId
properties:
deviceId:
type: integer
required: true
description: "Device Id/Number that channel belongs to"
channelId:
type: integer
required: true
description: "Channel Id/Number of the channel within the device"

4
sdrbase/resources/webapi/doc/swagger/include/RemoteOutput.yaml

@ -19,10 +19,10 @@ RemoteOutputSettings: @@ -19,10 +19,10 @@ RemoteOutputSettings:
dataPort:
type: integer
deviceIndex:
device: remote SDRangel instance deviceset index
description: remote SDRangel instance deviceset index
type: integer
channelIndex:
device: remote SDRangel instance channel index
description: remote SDRangel instance channel index
type: integer
useReverseAPI:
description: Synchronize with reverse API (1 for yes, 0 for no)

2
sdrbase/resources/webapi/doc/swagger/include/WDSPRx.yaml

@ -76,7 +76,7 @@ WDSPRxSettings: @@ -76,7 +76,7 @@ WDSPRxSettings:
nbLeadTime:
type: number
format: float
descriuption: Advance time (s)
description: Advance time (s)
nbLagTime:
type: number
format: float

4
sdrbase/resources/webapi/doc/swagger/swagger.yaml

@ -2973,7 +2973,6 @@ definitions: @@ -2973,7 +2973,6 @@ definitions:
FeatureSet:
description: "Grouping of features"
required:
- index
- featurecount
properties:
featurecount:
@ -3018,7 +3017,6 @@ definitions: @@ -3018,7 +3017,6 @@ definitions:
required:
- index
- hwType
- streamIndex
- sequence
- serial
- centerFrequency
@ -3422,7 +3420,6 @@ definitions: @@ -3422,7 +3420,6 @@ definitions:
description: "Group of configuration"
required:
- groupName
- nbPresets
properties:
groupName:
description: "Name of the configuration group"
@ -3530,4 +3527,3 @@ responses: @@ -3530,4 +3527,3 @@ responses:
description: Function not implemented
schema:
$ref: "#/definitions/ErrorResponse"

12
swagger/docker/compose/compose.yml

@ -22,6 +22,18 @@ services: @@ -22,6 +22,18 @@ services:
networks:
default:
ipv4_address: 172.20.0.3
swaggerclient:
image: "jeanberu/swagger-cli"
user: "1000:1000"
entrypoint: "/bin/sh"
container_name: "sdrangel_swaggerclient"
volumes:
- "${SDRANGEL_BASE}:/opt/build/sdrangel:rw"
stdin_open: true
tty: true
networks:
default:
ipv4_address: 172.20.0.4
networks:
default:
driver: bridge

10
swagger/docker/readme.md

@ -41,8 +41,14 @@ Use `run.sh` to create or delete the Docker compose stack. It takes the followin @@ -41,8 +41,14 @@ Use `run.sh` to create or delete the Docker compose stack. It takes the followin
- `-b`: SDRangel source code root path (default `/opt/build/sdrangel`)
- `-c`: Compose stack name (default `sdrangelswg`)
The stack is composed of two containers sharing the `172.20.0.0/16` network internally.
The stack is composed of three containers sharing the `172.20.0.0/16` network internally.
- `sdrangel_swgserver`: The http server that listens on port `8081` serving files in `/opt/build/sdrangel/swagger/sdrangel`
- `sdrangel_swgcodegen`: The container with the Swagger code generator. The working directory is `/opt/build/sdrangel/swagger/sdrangel`.
- `sdrangel_swgcodegen`: The container with the Swagger code generator. The working directory is `/opt/build/sdrangel/swagger/sdrangel`
- `sdrangel_swaggerclient`: based on the `jeanberu/swagger-cli` image it can be used to validate the swagger schema (see next).
Use `login.sh` to start a shell in the `sdrangel_swgcodegen` container. At the prompt run `generate.sh` to generate the code from the Swagger definition files.
To validate the swagger schema:
- Enter the `sdrangel_swaggerclient` container with: `docker exec -it sdrangel_swaggerclient /bin/sh`
- Validate the schema with the command: `swagger-cli validate /opt/build/sdrangel/swagger/sdrangel/api/swagger/swagger.yaml`
- Correct errors from the most inner ones (maximum tabs). Top level errors usually result from low level errors and are therefore quite cryptic.

5
swagger/sdrangel/api/swagger/include/DemodAnalyzer.yaml

@ -42,12 +42,13 @@ DemodAnalyzerSettings: @@ -42,12 +42,13 @@ DemodAnalyzerSettings:
DemodAnalyzerActions:
description: "Demod Analyzer actions"
required:
- deviceId
- channelId
properties:
deviceId:
type: integer
required: true
description: "Device Id/Number that channel belongs to"
channelId:
type: integer
required: true
description: "Channel Id/Number of the channel within the device"

5
swagger/sdrangel/api/swagger/include/MorseDecoder.yaml

@ -59,12 +59,13 @@ MorseDecoderSettings: @@ -59,12 +59,13 @@ MorseDecoderSettings:
MorseDecoderActions:
description: "Morse Decoder actions"
required:
- deviceId
- channelId
properties:
deviceId:
type: integer
required: true
description: "Device Id/Number that channel belongs to"
channelId:
type: integer
required: true
description: "Channel Id/Number of the channel within the device"

4
swagger/sdrangel/api/swagger/include/RemoteOutput.yaml

@ -19,10 +19,10 @@ RemoteOutputSettings: @@ -19,10 +19,10 @@ RemoteOutputSettings:
dataPort:
type: integer
deviceIndex:
device: remote SDRangel instance deviceset index
description: remote SDRangel instance deviceset index
type: integer
channelIndex:
device: remote SDRangel instance channel index
description: remote SDRangel instance channel index
type: integer
useReverseAPI:
description: Synchronize with reverse API (1 for yes, 0 for no)

2
swagger/sdrangel/api/swagger/include/WDSPRx.yaml

@ -76,7 +76,7 @@ WDSPRxSettings: @@ -76,7 +76,7 @@ WDSPRxSettings:
nbLeadTime:
type: number
format: float
descriuption: Advance time (s)
description: Advance time (s)
nbLagTime:
type: number
format: float

4
swagger/sdrangel/api/swagger/swagger.yaml

@ -2973,7 +2973,6 @@ definitions: @@ -2973,7 +2973,6 @@ definitions:
FeatureSet:
description: "Grouping of features"
required:
- index
- featurecount
properties:
featurecount:
@ -3018,7 +3017,6 @@ definitions: @@ -3018,7 +3017,6 @@ definitions:
required:
- index
- hwType
- streamIndex
- sequence
- serial
- centerFrequency
@ -3422,7 +3420,6 @@ definitions: @@ -3422,7 +3420,6 @@ definitions:
description: "Group of configuration"
required:
- groupName
- nbPresets
properties:
groupName:
description: "Name of the configuration group"
@ -3530,4 +3527,3 @@ responses: @@ -3530,4 +3527,3 @@ responses:
description: Function not implemented
schema:
$ref: "#/definitions/ErrorResponse"

13
swagger/sdrangel/code/html2/index.html

@ -5530,6 +5530,7 @@ margin-bottom: 20px; @@ -5530,6 +5530,7 @@ margin-bottom: 20px;
"description" : "List of DV serial devices available in the system"
};
defs.DemodAnalyzerActions = {
"required" : [ "channelId", "deviceId" ],
"properties" : {
"deviceId" : {
"type" : "integer",
@ -10587,6 +10588,7 @@ margin-bottom: 20px; @@ -10587,6 +10588,7 @@ margin-bottom: 20px;
"description" : "MetisMISOSettings"
};
defs.MorseDecoderActions = {
"required" : [ "channelId", "deviceId" ],
"properties" : {
"deviceId" : {
"type" : "integer",
@ -13257,10 +13259,12 @@ margin-bottom: 20px; @@ -13257,10 +13259,12 @@ margin-bottom: 20px;
"type" : "integer"
},
"deviceIndex" : {
"type" : "integer"
"type" : "integer",
"description" : "remote SDRangel instance deviceset index"
},
"channelIndex" : {
"type" : "integer"
"type" : "integer",
"description" : "remote SDRangel instance channel index"
},
"useReverseAPI" : {
"type" : "integer",
@ -17230,7 +17234,8 @@ margin-bottom: 20px; @@ -17230,7 +17234,8 @@ margin-bottom: 20px;
},
"nbLeadTime" : {
"type" : "number",
"format" : "float"
"format" : "float",
"description" : "Advance time (s)"
},
"nbLagTime" : {
"type" : "number",
@ -59472,7 +59477,7 @@ except ApiException as e: @@ -59472,7 +59477,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2025-05-03T17:59:40.379+02:00
Generated 2025-05-29T12:27:25.321+02:00
</div>
</div>
</div>

Loading…
Cancel
Save