Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

airbyte-lib: Connector documentation #33063

Merged
merged 24 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docusaurus/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const darkCodeTheme = themes.dracula;

const docsHeaderDecoration = require("./src/remark/docsHeaderDecoration");
const productInformation = require("./src/remark/productInformation");
const specDecoration = require("./src/remark/specDecoration");

const redirects = yaml.load(
fs.readFileSync(path.join(__dirname, "redirects.yml"), "utf-8")
Expand Down Expand Up @@ -89,7 +90,7 @@ const config = {
editUrl: "https://github.com/airbytehq/airbyte/blob/master/docs",
path: "../docs",
exclude: ["**/*.inapp.md"],
remarkPlugins: [docsHeaderDecoration, productInformation],
remarkPlugins: [docsHeaderDecoration, productInformation, specDecoration],
},
blog: false,
theme: {
Expand Down
3 changes: 3 additions & 0 deletions docusaurus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"@fortawesome/free-regular-svg-icons": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"@headlessui/react": "^1.7.18",
"@mdx-js/react": "^3.0.0",
"async": "2.6.4",
"autoprefixer": "10.4.16",
Expand All @@ -105,6 +106,7 @@
"docusaurus-plugin-hubspot": "^1.0.0",
"docusaurus-plugin-segment": "^1.0.3",
"js-yaml": "^4.1.0",
"json-schema-faker": "^0.5.4",
"node-fetch": "^3.3.2",
"nth-check": "2.0.1",
"postcss-convert-values": "6.0.1",
Expand All @@ -121,6 +123,7 @@
"react-dom": "^18.2.0",
"react-markdown": "^8.0.7",
"react-router": "5.3.3",
"sanitize-html": "^2.11.0",
"sockjs": "0.3.24",
"trim": "0.0.3",
"unist-builder": "^4.0.0",
Expand Down
92 changes: 92 additions & 0 deletions docusaurus/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions docusaurus/src/components/AirbyteLibExample.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from "react";
import { JSONSchemaFaker } from "json-schema-faker";
import CodeBlock from '@theme/CodeBlock';


export const AirbyteLibExample = ({
specJSON,
connector
}) => {
const spec = JSON.parse(specJSON);
const fakeConfig = JSONSchemaFaker.generate(spec);
return <>
<p>
Install the Python library via:
</p>
<CodeBlock
language="bash">{"pip install airbyte-lib"}</CodeBlock>
<p>Then, execute a sync by loading the connector like this:</p>
<CodeBlock
language="python"
>{`import airbyte_lib as ab

config = ${JSON.stringify(fakeConfig, null, 2)}

result = ab.get_connector(
"${connector}",
config=config,
).read_all()

for record in result.cache.streams["my_stream:name"]:
print(record)`} </CodeBlock>
<p>You can find more information in the airbyte_lib quickstart guide.</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this quickstart guide already exist, so we could link to it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't yet - I will work on this on a separate PR. As mentioned, this component will not be rendered yet, in this PR I just want to get the first version of the components ready.

</>;
};
3 changes: 3 additions & 0 deletions docusaurus/src/components/HeaderDecoration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const CROSS_ICON = (
export const HeaderDecoration = ({
isOss: isOssString,
isCloud: isCloudString,
isPypiPublished: isPypiPublishedString,
dockerImageTag,
supportLevel,
iconUrl,
Expand All @@ -36,6 +37,7 @@ export const HeaderDecoration = ({
}) => {
const isOss = isOssString.toUpperCase() === "TRUE";
const isCloud = isCloudString.toUpperCase() === "TRUE";
const isPypiPublished = isPypiPublishedString.toUpperCase() === "TRUE";

return (
<>
Expand All @@ -49,6 +51,7 @@ export const HeaderDecoration = ({
<span className={isOss ? styles.available : styles.unavailable}>
{isOss ? CHECK_ICON : CROSS_ICON} Airbyte OSS
</span>
{isPypiPublished && <a href="#usage-with-airbyte-lib" className={styles.available}>{CHECK_ICON} airbyte_lib</a>}
</dd>
</div>
<div>
Expand Down
Loading
Loading