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

open api generator #47

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jaeyson
Copy link
Owner

@jaeyson jaeyson commented Aug 12, 2024

Implements #36

@jaeyson jaeyson added documentation Improvements or additions to documentation enhancement New feature or request labels Aug 12, 2024
@jaeyson jaeyson self-assigned this Aug 12, 2024
docker-compose.yml Outdated Show resolved Hide resolved
@jaeyson
Copy link
Owner Author

jaeyson commented Aug 15, 2024

@kianmeng is this it? like add the yaml file then what's next?

config/config.exs Outdated Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@kianmeng
Copy link
Contributor

@kianmeng is this it? like add the yaml file then what's next?

Next step is to link ExTypesense to OpenApiTypesense?

@jaeyson
Copy link
Owner Author

jaeyson commented Aug 20, 2024

The generated API code should be in /lib/ folder and we shouldn't ignore them.

@kianmeng kindly check inside /lib/open_api_typesense folder, is that correct? I added the generated files


@kianmeng is this it? like add the yaml file then what's next?

Next step is to link ExTypesense to OpenApiTypesense?

@kianmeng what does it mean to link it to OpenApiTypesense? Sorry I'm clueless on that part 🥲

@jaeyson jaeyson requested a review from kianmeng August 20, 2024 10:05
@kianmeng
Copy link
Contributor

@kianmeng kindly check inside /lib/open_api_typesense folder, is that correct? I added the generated files

The lib/open_api_typesense/openapi.yml file should be in priv/openapi.yml?

@kianmeng what does it mean to link it to OpenApiTypesense? Sorry I'm clueless on that part 🥲

If I understand it correctly, I'm also rather new to this, something like this:

From:

  def list_collections(conn \\ Connection.new()) do
    case HttpClient.request(conn, %{method: :get, path: @collections_path}) do
      {:ok, collections} ->
        Stream.map(collections, &convert_to_struct/1) |> Enum.to_list()

      {:error, reason} ->
        {:error, reason}
    end
  end

To:

  def list_collections(conn \\ Connection.new()) do    
    case OpenApiTypesense.Collections.get_collections() do
      # response will be different from you one.
      {:ok, collections} = response ->
        response
      :error ->
        {:error, error}
    end
  end

However, we need to create a default client, OpenApiTypesense.Client and ensure the connection to work first?

iex(1)> OpenApiTypesense.Collections.get_collections()
** (UndefinedFunctionError) function OpenApiTypesense.Client.request/1 is undefined (module OpenApiTypesense.Client is not available)
    OpenApiTypesense.Client.request(%{call: {OpenApiTypesense.Collections, :get_collections}, args: [], opts: [], response: [{200, [{OpenApiTypesense.CollectionResponse, :t}]}], url: "/collections", method: :get})
    iex:1: (file)

Perhaps you can raise your question on its usage at https://github.com/aj-foster/open-api-generator/discussions ?

@jaeyson
Copy link
Owner Author

jaeyson commented Aug 28, 2024

However, we need to create a default client, OpenApiTypesense.Client and ensure the connection to work first?

iex(1)> OpenApiTypesense.Collections.get_collections()
** (UndefinedFunctionError) function OpenApiTypesense.Client.request/1 is undefined (module OpenApiTypesense.Client is not available)
    OpenApiTypesense.Client.request(%{call: {OpenApiTypesense.Collections, :get_collections}, args: [], opts: [], response: [{200, [{OpenApiTypesense.CollectionResponse, :t}]}], url: "/collections", method: :get})
    iex:1: (file)

Perhaps you can raise your question on its usage at https://github.com/aj-foster/open-api-generator/discussions ?

Will do @kianmeng 👌🏾, I'll ask it there. Thank you 🙏🏾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Replace the API wrapper code with with code generated from open-api-generator
2 participants