Add information about direct Openapi ingestion#62
Conversation
Add docs and update http to 1.0.2
Fix response json parsing when content type is wrong
…col/dev Update CLI
- Add detailed OpenAPI ingestion guide with 5 different methods - Include working code examples for all ingestion approaches - Add prominent OpenAPI section to main README - All code snippets tested and validated - Zero infrastructure approach highlighted
- Remove unnecessary duplication and complexity - Focus on core functionality with minimal examples - Reduce from verbose guide to concise reference - All code snippets tested and working
| # Or use UTCP Client configuration for automatic detection | ||
| from utcp.utcp_client import UtcpClient | ||
|
|
||
| client = await UtcpClient.create(config={ |
Contributor
There was a problem hiding this comment.
Using await at top level in this snippet will not run in a standard Python script; wrap in an async function or use asyncio.run.
Prompt for AI agents
Address the following comment on README.md at line 568:
<comment>Using await at top level in this snippet will not run in a standard Python script; wrap in an async function or use asyncio.run.</comment>
<file context>
@@ -538,4 +538,61 @@ The build process now involves building each package (`core` and `plugins`) sepa
+# Or use UTCP Client configuration for automatic detection
+from utcp.utcp_client import UtcpClient
+
+client = await UtcpClient.create(config={
+ "manual_call_templates": [{
+ "name": "github",
</file context>
|
|
||
| async def load_remote_spec(url): | ||
| async with aiohttp.ClientSession() as session: | ||
| async with session.get(url) as response: |
Contributor
There was a problem hiding this comment.
Missing response.raise_for_status() before reading the response may hide HTTP errors; add it in the batch processing example.
Prompt for AI agents
Address the following comment on docs/openapi-ingestion.md at line 44:
<comment>Missing response.raise_for_status() before reading the response may hide HTTP errors; add it in the batch processing example.</comment>
<file context>
@@ -0,0 +1,149 @@
+
+async def load_remote_spec(url):
+ async with aiohttp.ClientSession() as session:
+ async with session.get(url) as response:
+ response.raise_for_status()
+ openapi_spec = await response.json()
</file context>
| from utcp_http.openapi_converter import OpenApiConverter | ||
|
|
||
| async def load_remote_spec(url): | ||
| async with aiohttp.ClientSession() as session: |
Contributor
There was a problem hiding this comment.
Creating a new aiohttp.ClientSession inside the loop adds unnecessary overhead and prevents connection reuse; create one session and reuse it for all URLs.
Prompt for AI agents
Address the following comment on docs/openapi-ingestion.md at line 43:
<comment>Creating a new aiohttp.ClientSession inside the loop adds unnecessary overhead and prevents connection reuse; create one session and reuse it for all URLs.</comment>
<file context>
@@ -0,0 +1,149 @@
+from utcp_http.openapi_converter import OpenApiConverter
+
+async def load_remote_spec(url):
+ async with aiohttp.ClientSession() as session:
+ async with session.get(url) as response:
+ response.raise_for_status()
</file context>
| async with aiohttp.ClientSession() as session: | ||
| async with session.get(url) as response: | ||
| response.raise_for_status() | ||
| openapi_spec = await response.json() |
Contributor
There was a problem hiding this comment.
Using response.json() will fail for YAML specs in spec_urls; parse text with yaml.safe_load to support both YAML and JSON.
Prompt for AI agents
Address the following comment on docs/openapi-ingestion.md at line 46:
<comment>Using response.json() will fail for YAML specs in spec_urls; parse text with yaml.safe_load to support both YAML and JSON.</comment>
<file context>
@@ -0,0 +1,149 @@
+ async with aiohttp.ClientSession() as session:
+ async with session.get(url) as response:
+ response.raise_for_status()
+ openapi_spec = await response.json()
+
+ converter = OpenApiConverter(openapi_spec, spec_url=url)
</file context>
- Add plugin comments to all UTCP imports - Show which imports come from core vs utcp-http plugin - Clarify YAML loader also handles JSON files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by cubic
Add OpenAPI ingestion docs and a README quick start to convert OpenAPI 2.0/3.0 specs into UTCP tools with no extra infrastructure. This enables direct HTTP tool generation from existing REST APIs with clear, working examples.