Skip to content

Commit

Permalink
doc: add validators doc
Browse files Browse the repository at this point in the history
  • Loading branch information
mutantsan committed Nov 19, 2024
1 parent 7a2192a commit 49525e0
Show file tree
Hide file tree
Showing 32 changed files with 2,097 additions and 544 deletions.
25 changes: 25 additions & 0 deletions ckanext/event_audit/logic/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,32 @@


def audit_repo_exists(value: Any, context: Context) -> Any:
"""Check if the repository with the given name is registered.
Args:
value (Any): The repository name.
context (Context): The CKAN context.
Returns:
Any: The repository name if it exists.
Raises:
tk.Invalid: If the repository does not exist.
"""
if value not in utils.get_available_repos():
raise tk.Invalid(f"Repository `{value}` is not registered")

return value

def add_numbers(a: int, b: int) -> int:
"""
Add two numbers.
Args:
a (int): The first number.
b (int): The second number.
Returns:
int: The sum of the two numbers.
"""
return a + b
6 changes: 6 additions & 0 deletions docs/validators.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Validators

::: event_audit.logic.validators.audit_repo_exists
options:
show_source: true
show_root_heading: true
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ nav:
- install.md
- usage.md
- interfaces.md
- validators.md
- utils.md

- Configuration:
Expand Down
46 changes: 33 additions & 13 deletions site/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


<link rel="icon" href="/ckanext-event-audit/img/favicon.ico">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.44">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.42">



Expand Down Expand Up @@ -331,6 +331,26 @@



<li class="md-nav__item">
<a href="/ckanext-event-audit/validators/" class="md-nav__link">


<span class="md-ellipsis">
Validators
</span>


</a>
</li>









<li class="md-nav__item">
<a href="/ckanext-event-audit/utils/" class="md-nav__link">

Expand Down Expand Up @@ -371,10 +391,10 @@



<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" >
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7" >


<label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
<label class="md-nav__link" for="__nav_7" id="__nav_7_label" tabindex="0">


<span class="md-ellipsis">
Expand All @@ -385,8 +405,8 @@
<span class="md-nav__icon md-icon"></span>
</label>

<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_6">
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_7_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_7">
<span class="md-nav__icon md-icon"></span>
Configuration
</label>
Expand Down Expand Up @@ -530,10 +550,10 @@



<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7" >
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_8" >


<label class="md-nav__link" for="__nav_7" id="__nav_7_label" tabindex="0">
<label class="md-nav__link" for="__nav_8" id="__nav_8_label" tabindex="0">


<span class="md-ellipsis">
Expand All @@ -544,8 +564,8 @@
<span class="md-nav__icon md-icon"></span>
</label>

<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_7_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_7">
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_8_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_8">
<span class="md-nav__icon md-icon"></span>
Exporters
</label>
Expand Down Expand Up @@ -691,10 +711,10 @@



<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_8" >
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_9" >


<label class="md-nav__link" for="__nav_8" id="__nav_8_label" tabindex="0">
<label class="md-nav__link" for="__nav_9" id="__nav_9_label" tabindex="0">


<span class="md-ellipsis">
Expand All @@ -705,8 +725,8 @@
<span class="md-nav__icon md-icon"></span>
</label>

<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_8_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_8">
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_9_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_9">
<span class="md-nav__icon md-icon"></span>
Repositories
</label>
Expand Down
26 changes: 1 addition & 25 deletions site/assets/_mkdocstrings.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,20 @@
float: right;
}

/* Parameter headings must be inline, not blocks. */
.doc-heading-parameter {
display: inline;
}

/* Prefer space on the right, not the left of parameter permalinks. */
.doc-heading-parameter .headerlink {
margin-left: 0 !important;
margin-right: 0.2rem;
}

/* Backward-compatibility: docstring section titles in bold. */
.doc-section-title {
font-weight: bold;
}

/* Symbols in Navigation and ToC. */
:root, :host,
:root,
[data-md-color-scheme="default"] {
--doc-symbol-parameter-fg-color: #df50af;
--doc-symbol-attribute-fg-color: #953800;
--doc-symbol-function-fg-color: #8250df;
--doc-symbol-method-fg-color: #8250df;
--doc-symbol-class-fg-color: #0550ae;
--doc-symbol-module-fg-color: #5cad0f;

--doc-symbol-parameter-bg-color: #df50af1a;
--doc-symbol-attribute-bg-color: #9538001a;
--doc-symbol-function-bg-color: #8250df1a;
--doc-symbol-method-bg-color: #8250df1a;
Expand All @@ -61,14 +48,12 @@
}

[data-md-color-scheme="slate"] {
--doc-symbol-parameter-fg-color: #ffa8cc;
--doc-symbol-attribute-fg-color: #ffa657;
--doc-symbol-function-fg-color: #d2a8ff;
--doc-symbol-method-fg-color: #d2a8ff;
--doc-symbol-class-fg-color: #79c0ff;
--doc-symbol-module-fg-color: #baff79;

--doc-symbol-parameter-bg-color: #ffa8cc1a;
--doc-symbol-attribute-bg-color: #ffa6571a;
--doc-symbol-function-bg-color: #d2a8ff1a;
--doc-symbol-method-bg-color: #d2a8ff1a;
Expand All @@ -83,15 +68,6 @@ code.doc-symbol {
font-weight: bold;
}

code.doc-symbol-parameter {
color: var(--doc-symbol-parameter-fg-color);
background-color: var(--doc-symbol-parameter-bg-color);
}

code.doc-symbol-parameter::after {
content: "param";
}

code.doc-symbol-attribute {
color: var(--doc-symbol-attribute-fg-color);
background-color: var(--doc-symbol-attribute-bg-color);
Expand Down
46 changes: 33 additions & 13 deletions site/configure/active_repo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


<link rel="icon" href="../../img/favicon.ico">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.44">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.42">



Expand Down Expand Up @@ -342,6 +342,26 @@



<li class="md-nav__item">
<a href="../../validators/" class="md-nav__link">


<span class="md-ellipsis">
Validators
</span>


</a>
</li>









<li class="md-nav__item">
<a href="../../utils/" class="md-nav__link">

Expand Down Expand Up @@ -384,10 +404,10 @@



<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" checked>
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7" checked>


<label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
<label class="md-nav__link" for="__nav_7" id="__nav_7_label" tabindex="0">


<span class="md-ellipsis">
Expand All @@ -398,8 +418,8 @@
<span class="md-nav__icon md-icon"></span>
</label>

<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_6">
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_7_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_7">
<span class="md-nav__icon md-icon"></span>
Configuration
</label>
Expand Down Expand Up @@ -553,10 +573,10 @@



<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7" >
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_8" >


<label class="md-nav__link" for="__nav_7" id="__nav_7_label" tabindex="0">
<label class="md-nav__link" for="__nav_8" id="__nav_8_label" tabindex="0">


<span class="md-ellipsis">
Expand All @@ -567,8 +587,8 @@
<span class="md-nav__icon md-icon"></span>
</label>

<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_7_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_7">
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_8_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_8">
<span class="md-nav__icon md-icon"></span>
Exporters
</label>
Expand Down Expand Up @@ -714,10 +734,10 @@



<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_8" >
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_9" >


<label class="md-nav__link" for="__nav_8" id="__nav_8_label" tabindex="0">
<label class="md-nav__link" for="__nav_9" id="__nav_9_label" tabindex="0">


<span class="md-ellipsis">
Expand All @@ -728,8 +748,8 @@
<span class="md-nav__icon md-icon"></span>
</label>

<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_8_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_8">
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_9_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_9">
<span class="md-nav__icon md-icon"></span>
Repositories
</label>
Expand Down
Loading

0 comments on commit 49525e0

Please sign in to comment.