updated specs
This commit is contained in:
parent
fb1f9a4d07
commit
ef46f2183c
17
README.md
17
README.md
@ -303,10 +303,27 @@ Links to external documentation.
|
||||
```yaml
|
||||
# __externalDocs.yaml
|
||||
externalDocs:
|
||||
|
||||
# docs.yaml
|
||||
description: DummyJSON Documentation
|
||||
url: https://dummyjson.com/docs
|
||||
```
|
||||
|
||||
The `externalDocs` field provides links to additional documentation outside the API spec. It can be used at:
|
||||
- **Global level** (as shown above) - links to overall API documentation
|
||||
- **Operation level** - links to specific endpoint guides
|
||||
|
||||
Tools like Swagger UI render these links prominently for easy access to tutorials, guides, and examples.
|
||||
|
||||
**Try it:**
|
||||
```bash
|
||||
# View the external documentation
|
||||
curl https://dummyjson.com/docs
|
||||
|
||||
# Or open in browser
|
||||
open https://dummyjson.com/docs
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```swift
|
||||
|
||||
@ -33,7 +33,14 @@ public struct YAMLMerger {
|
||||
}
|
||||
|
||||
private func cleanedContent(_ text: String) -> String {
|
||||
let regex = try! NSRegularExpression(pattern: "(\\n\\s*){2,}", options: [])
|
||||
let pattern = "(\\n\\s*){2,}"
|
||||
let regex: NSRegularExpression
|
||||
do {
|
||||
regex = try NSRegularExpression(pattern: pattern, options: [])
|
||||
} catch {
|
||||
// If the regex pattern fails to compile, return the original text unchanged.
|
||||
return text
|
||||
}
|
||||
let range = NSRange(location: 0, length: text.utf16.count)
|
||||
return regex.stringByReplacingMatches(in: text, options: [], range: range, withTemplate: "\n\n")
|
||||
}
|
||||
@ -53,7 +60,7 @@ public struct YAMLMerger {
|
||||
if !isFirstFile {
|
||||
output += "\n" // only between files
|
||||
}
|
||||
output += content
|
||||
output += cleanedContent(content)
|
||||
isFirstFile = false
|
||||
}
|
||||
}
|
||||
|
||||
@ -482,8 +482,8 @@ webhooks:
|
||||
description: Webhook received successfully
|
||||
'400':
|
||||
description: Bad request
|
||||
|
||||
schemas:
|
||||
components:
|
||||
schemas:
|
||||
|
||||
|
||||
AuthResponse:
|
||||
|
||||
9
Tests/YAMLMergerTests/Schema/01_Info/api-info.yaml
Normal file
9
Tests/YAMLMergerTests/Schema/01_Info/api-info.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
title: OpenAPI Generation Demo
|
||||
version: 1.0.0
|
||||
description: Demonstration of OpenAPI specification generation using YAMLMerger
|
||||
contact:
|
||||
name: API Support
|
||||
email: support@example.com
|
||||
license:
|
||||
name: Apache 2.0
|
||||
url: https://www.apache.org/licenses/LICENSE-2.0.html
|
||||
2
Tests/YAMLMergerTests/Schema/08_ExternalDocs/docs.yaml
Normal file
2
Tests/YAMLMergerTests/Schema/08_ExternalDocs/docs.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
description: DummyJSON Documentation
|
||||
url: https://dummyjson.com/docs
|
||||
Loading…
Reference in New Issue
Block a user