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

improve docstring for swagger readability #39

Merged
merged 7 commits into from
Feb 19, 2025
Merged

Conversation

mki-c2c
Copy link
Contributor

@mki-c2c mki-c2c commented Feb 14, 2025

Improve doc texts displayed in Open API interface

@mki-c2c
Copy link
Contributor Author

mki-c2c commented Feb 14, 2025

I did some domcumentation, the display in swagger has become really nice now, however, the practice of adding descriptions in FastAPI makes the code (especially in main.py quite cluttered and ugly. What do you think about it ?

@jeanmi151
Copy link
Contributor

I did some domcumentation, the display in swagger has become really nice now, however, the practice of adding descriptions in FastAPI makes the code (especially in main.py quite cluttered and ugly. What do you think about it ?

Make the source code easier understandable (even if it had much lines) and api doc much better
i guess it is okay to add this logic

Copy link
Contributor

@arnaud-morvan arnaud-morvan left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

def get_sources() -> list[dict[str, str]]:
"""
List all the geonetwork source servers registered in the config file
:returns: A list of each server with the name defined in the config file and the API URL
"""
return config.get_gn_sources()


@app.get("/destinations")
def get_destinations() -> list[dict[str, str]]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems missing the return type which was defined in models.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I forgot to insert list[DestinationsResponseElement]
thanks

@mki-c2c mki-c2c force-pushed the GSREN-237_xsl_transform branch from 9872933 to 7113511 Compare February 18, 2025 07:49
@mki-c2c mki-c2c changed the base branch from GSREN-237_xsl_transform to main February 18, 2025 08:25


class PreviewClone(BaseModel):
geonetwork_resources: list[PreviewGN]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@arnaud-morvan
as discussed, I changed the fields metadata and data to geonetwork_resources and geoserver_resources
Is this still OK for you on frontend side ?

@mki-c2c mki-c2c merged commit f224243 into main Feb 19, 2025
3 checks passed
@mki-c2c mki-c2c deleted the GSREN-231_doc_api branch February 19, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants