fix(rust): revamp the OpenAPI specification#1564
Conversation
|
I love schemas in general 😄 , they enable so many useful things... IIUC, |
IMHO there are two use cases:
The Actually, I do not think it would be that hard to build our own generator for our use case. |
|
If you want to give it a try, Hey API seems to be a nice alternative: |
Trello: https://trello.com/c/nV7mjrf9/ This is the first step towards adapting the storage code to use queries. As this part of the code is rather complex, we decided to move as many components as possible to TypeScript to have a kind of security net. ## What is included * Add a set of types from from our OpenAPI docs (see #1564) in `api/storage/types`. * Add a set of storage UI types in `types/storage`. We should unify the types, but let's do it later. * Define a new `api/storage` module moving big chunks of the `StorageClient` code. * Define a set of queries under `queries/storage`. * Adapt the `ProposalPage` component to use queries. It retrieves a lot of information that injects to nested components. * Convert `ProposalPage` and `InstallationDeviceField` to TypeScript. ## What is missing * As you may see, the front end is not building. That problems (and other subtle bugs) will be fixed as we adapt the rest of storage components to TypeScript. So a bunch of additional pull requests will follow. * Additionally, we are removing all those skeletons from the UI. We will use a unified mechanism.
48ee076 to
aad4c28
Compare
aad4c28 to
5f4a160
Compare
| - name: Generate and validate the OpenAPI specification | ||
| run: | | ||
| cargo xtask openapi | ||
| openapi-spec-validator out/openapi/* |
There was a problem hiding this comment.
great that it is validated 👍 , but does it also find missing piece?
There was a problem hiding this comment.
Yes, if it is mentioned and not defined, it is found here (most of the problems were like that). About completely forgotten stuff, we might need to try something different (but I do not know what).
Update to release version 11. * #1495 * #1564 * #1617 * #1618 * #1625 * #1626 * #1627 * #1628 * #1630 * #1631 * #1632 * #1633 * #1634 * #1635 * #1636 * #1639 * #1640 * #1641 * #1642 * #1643 * #1644 * #1645 * #1646 * #1647 * #1648 * #1649 * #1650 * #1651 * #1652 * #1654 * #1655 * #1656 * #1657 * #1660 * #1663 * #1666 * #1667 * #1668 * #1670 * #1671 * #1673 * #1674 * #1675 * #1676 * #1677 * #1681 * #1682 * #1683 * #1684 * #1687 * #1688 * #1689 * #1690 * #1691 * #1692 * #1693 * #1694 * #1695 * #1696 * #1698 * #1699 * #1702 * #1703 * #1704 * #1705 * #1707 * #1708 * #1709 * #1710 * #1711 * #1712 * #1713 * #1714 * #1715 * #1716 * #1717 * #1718 * #1720 * #1721 * #1722 * #1723 * #1727 * #1728 * #1729 * #1731 * #1732 * #1733 * #1734 * #1735 * #1736 * #1737 * #1740 * #1741 * #1743 * #1744 * #1745 * #1746 * #1751 * #1753 * #1754 * #1755 * #1757 * #1762 * #1763 * #1764 * #1765 * #1766 * #1767 * #1769 * #1771 * #1772 * #1773 * #1774 * #1777 * #1778 * #1785 * #1786 * #1787 * #1788 * #1789 * #1790 * #1791 * #1792 * #1793 * #1794 * #1795 * #1796 * #1797 * #1798 * #1799 * #1800 * #1802 * #1803 * #1804 * #1805 * #1807 * #1808 * #1809 * #1810 * #1811 * #1812 * #1814 * #1815 * #1821 * #1822 * #1823 * #1824 * #1825 * #1826 * #1827 * #1828 * #1830 * #1831 * #1832 * #1833 * #1834 * #1835 * #1836 * #1837 * #1838 * #1839 * #1840 * #1841 * #1842 * #1843 * #1844 * #1845 * #1847 * #1848 * #1849 * #1850 * #1851 * #1854 * #1855 * #1856 * #1857 * #1860 * #1861 * #1863 * #1864 * #1865 * #1866 * #1867 * #1871 * #1872 * #1873 * #1875 * #1876 * #1877 * #1878 * #1880 * #1881 * #1882 * #1883 * #1884 * #1885 * #1886 * #1888 * #1889 * #1890
The
agama-web-server docscommand generates the OpenAPI specification of Agama's HTTP API. However, the resulting specification is badly broken 😢. This pull request aims to make the specification usable.Refactoring
Apart from being incomplete, the previous implementation had a few problems.
IpAddr,IpInet, etc.).For those reasons, we decided to use the builder API, which is pretty flexible. We also took the chance to split the generation into smaller pieces, making it easier to maintain.
Packaging the OpenAPI documentation
Instead of generating the OpenAPI spec at runtime, we can do it at build time and put the resulting JSON files in a separate package (
agama-openapi).Generating the
schema.d.tsYou can generate the API in two simple steps:
To do
Future work