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

Fix outdated docs and add "URL encoding chapter" #109

Merged
merged 9 commits into from May 8, 2023
Merged

Fix outdated docs and add "URL encoding chapter" #109

merged 9 commits into from May 8, 2023

Conversation

JOJ0
Copy link
Owner

@JOJ0 JOJ0 commented Mar 30, 2023

This fixes links to code snippets in CONTRIBUTING.md chapter "Implementation Examples" and adds a chapter about the newly introduced way of formatting strings in the query() method of ApiRequest.

@JOJ0
Copy link
Owner Author

JOJ0 commented Mar 30, 2023

As usual, it's longer than I thought it will be. Give me your critics! ;-) Best viewed in its rendered form in the dev branch: https://github.com/JOJ0/synadm/blob/dev/CONTRIBUTING.md#command-design

I tried to follow the wording from the Python docs: https://docs.python.org/3.9/library/string.html#formatstrings

Copy link
Collaborator

@JacksonChen666 JacksonChen666 left a comment

Choose a reason for hiding this comment

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

nitpicker noises


Since version 0.42 `synadm` encodes URL's in a central place - the `ApiRequest.query()` function in the `synadm.api` module.

Variables sent as part of the URL are required to be passed to the `query()` method **unaltered**. Do not use f-strings or str.format, let the `query()` method do the sanitizing of the URL.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add negative (unwanted) example and reason to do so (#96)?

(It would likely have to be part of the CONTRIBUTING.md itself instead of code in the repo)

Copy link
Owner Author

Choose a reason for hiding this comment

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

A negative example additionally to the positive one would certainly reassure that it is understood. I'll think about it.

CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated

Variables sent as part of the URL are required to be passed to the `query()` method **unaltered**. Do not use f-strings or str.format, let the `query()` method do the sanitizing of the URL.

If we take a look at the `user password` example in above's chapter, we have:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
If we take a look at the `user password` example in above's chapter, we have:
If we take a look at the `user_password` example in above's chapter, we have:

Copy link
Owner Author

Choose a reason for hiding this comment

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

Hmm I wanted to "refer to" the synadm user password command example. So maybe I was misleading with that.

CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated

### Submitting data & URL encoding

Since version 0.42 `synadm` encodes URL's in a central place - the `ApiRequest.query()` function in the `synadm.api` module.
Copy link
Collaborator

Choose a reason for hiding this comment

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

the ApiRequest.query() function

but that's not how we call the query function, right?

CONTRIBUTING.md Outdated

### Submitting data & URL encoding

Since version 0.42 `synadm` encodes URL's in a central place - the `ApiRequest.query()` function in the `synadm.api` module.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The thing has never been included in a release, yet. Referring to it specifically by commit SHA

Suggested change
Since version 0.42 `synadm` encodes URL's in a central place - the `ApiRequest.query()` function in the `synadm.api` module.
Since commit [6874939](https://github.com/JOJ0/synadm/commit/68749391d6a291d2fac229214f59924189c775ac), `synadm` encodes URL's in a central place - the `ApiRequest.query()` function in the `synadm.api` module.

Copy link
Owner Author

Choose a reason for hiding this comment

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

We will release this in 0.42 and then it stays correct forever.

Copy link
Collaborator

Choose a reason for hiding this comment

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

checks commit logs since v0.41.1 to dev branch

J0J0 Todos (7):
      Merge pull request #108 from JOJ0/default-draft-releases
      Update "Implement. Examples" chapter code-links
      Update "Helpers" chapter on CONTRIBUTING page
      Add URL-encoding chapter to CONTRIBUTING page
      Fix typos in URL-encoding chapter
      Apply suggestions from code review
      Apply suggestions from code review

Jackson Chen (2):
      make auto releases draft by default
      URL encoding in query function and refactor

Nope, doesn't seem like a minor release to me.

I think the commit should probably be included anyways alongside the commit itself, seems like a reasonable compromise of "when".

Copy link
Owner Author

@JOJ0 JOJ0 Apr 3, 2023

Choose a reason for hiding this comment

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

I would've called it a minor release since it kind of "revolutionises" quite some internals and might even introduce bugs we couldn't think of yet (Well, that is esoterically, I don't really think it will introduce bugs).

But I see your point that it actually doesn't bring any new feature, it just fixes a bug and prevents future issues.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yep you are right, it really doesn't hurt to link to the commit. If someone wants details, they can find them easily. , commiting right away....

CONTRIBUTING.md Outdated Show resolved Hide resolved
@JOJ0
Copy link
Owner Author

JOJ0 commented Apr 3, 2023

nitpicker noises

Thanks a lot! Nitpicking appreciated :-)

@JacksonChen666 JacksonChen666 self-requested a review April 9, 2023 13:01
JOJ0 and others added 8 commits May 8, 2023 15:19
on CONTRIBUTING page. Permalink to most current commits and display full
function compared to just a snippet, as we had previously.
Link to simply api.py without a line number. Line numbers will change. In this
case not useing permalinks to commits. The goal is showing the most recent
version of the available helpers and utils. Description points to where to find
them already.
on CONTRIBUTING page.
Co-authored-by: Jackson Chen <jackson@jacksonchen666.com>
Co-authored-by: Jackson Chen <jackson@jacksonchen666.com>
to state the exact point in time the query method's url-encoding feature was
introduced.
@JOJ0 JOJ0 merged commit 2dc7ff6 into master May 8, 2023
2 checks passed
@JOJ0
Copy link
Owner Author

JOJ0 commented May 8, 2023

Unfortunately I forgot to finish this one. There might have been some things that still could be improved but due to lack of time I'm deciding now to better merge it than have inaccurate docs any time longer. I read through it and think it should be understandable by our contributors.

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.

None yet

2 participants