Skip to content

Commit

Permalink
[IMP] fastapi: Add endpoint public_url field
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxxxzero committed Jun 18, 2024
1 parent a64cfa7 commit e9ba274
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions fastapi/models/fastapi_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ class FastapiEndpoint(models.Model):
docs_url: str = fields.Char(compute="_compute_urls")
redoc_url: str = fields.Char(compute="_compute_urls")
openapi_url: str = fields.Char(compute="_compute_urls")
public_url: str = fields.Char(
help="The public URL of the API, "
"this is used to construct absolute URLs in mails for example."
)
company_id = fields.Many2one(
"res.company",
compute="_compute_company_id",
Expand Down
2 changes: 1 addition & 1 deletion fastapi/models/fastapi_endpoint_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class FastapiEndpoint(models.Model):
)
demo_auth_method = fields.Selection(
selection=[("api_key", "Api Key"), ("http_basic", "HTTP Basic")],
string="Authenciation method",
string="Authentication method",
)

def _get_fastapi_routers(self) -> List[APIRouter]:
Expand Down
6 changes: 6 additions & 0 deletions fastapi/views/fastapi_endpoint.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
<field name="docs_url" widget="url" />
<field name="redoc_url" widget="url" />
<field name="openapi_url" widget="url" />
<field
name="public_url"
widget="url"
placeholder="https://api.shop.example.com/"
/>
</group>
</group>
<span name="configuration" />
Expand Down Expand Up @@ -95,6 +100,7 @@
<field name="docs_url" widget="url" />
<field name="redoc_url" widget="url" />
<field name="openapi_url" widget="url" />
<field name="public_url" widget="url" />
<button
name="action_sync_registry"
string="Sync Registry"
Expand Down

0 comments on commit e9ba274

Please sign in to comment.