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

custom-fields and custom-field-choices are supposed to be different endpoint #114

Closed
nautics889 opened this issue Apr 15, 2023 · 0 comments · Fixed by #115
Closed

custom-fields and custom-field-choices are supposed to be different endpoint #114

nautics889 opened this issue Apr 15, 2023 · 0 comments · Fixed by #115

Comments

@nautics889
Copy link
Contributor

In App class of pynautobot library there is method for retrieving data from '/api/extras/custom-fields/' endpoint. The method has name custom_choices().
And it can make some mess, because Nautobot service actually provide another endpoint "/api/extras/custom-field-choices/". So such naming can be somewhat confusing:
from /api/extras:

Extras API root view

GET /api/extras/


{
    ...
    "custom-field-choices": "http://localhost:8888/api/extras/custom-field-choices/",
    "custom-fields": "http://localhost:8888/api/extras/custom-fields/",
    ...
}

And they return completely different data.

Futhermore, there is no method to get data from "/api/extras/custom-field-choices/". Perhaps it should be implemented.

nautics889 added a commit to nautics889/pynautobot that referenced this issue Apr 16, 2023
Add method `custom_field_choices()` in `App` class.
Rename method `custom_choices()` to `custom_fields()`.
Update docstings for both methods according to returning data.
nautics889 added a commit to nautics889/pynautobot that referenced this issue Apr 16, 2023
Add test case `AppCustomFieldChoicesTestCase` for
`custom_field_choices()` method.
Rename test case for `custom_fields()` method.
Add using fixtures for mentioned test cases.
nautics889 added a commit to nautics889/pynautobot that referenced this issue Apr 16, 2023
Add missing JSON files with fixtures for tests for getting custom
fields.
nautics889 added a commit to nautics889/pynautobot that referenced this issue Apr 16, 2023
Attempt to fix test cases `AppCustomFieldsTestCase` and
`AppCustomFieldChoicesTestCase`.
nautics889 added a commit to nautics889/pynautobot that referenced this issue Apr 16, 2023
Attempt to fix test cases `AppCustomFieldsTestCase` and
`AppCustomFieldChoicesTestCase`.
nautics889 added a commit to nautics889/pynautobot that referenced this issue Apr 16, 2023
Attempt to fix test cases `AppCustomFieldsTestCase` and
`AppCustomFieldChoicesTestCase`.
nautics889 added a commit to nautics889/pynautobot that referenced this issue Apr 16, 2023
Fix test cases `AppCustomFieldsTestCase` and
`AppCustomFieldChoicesTestCase` for python 3.7 stable.
Update logic for checking passed arguments of mock's `call_args`.
@pszulczewski pszulczewski linked a pull request May 10, 2023 that will close this issue
nautics889 added a commit to nautics889/pynautobot that referenced this issue Jul 15, 2023
* (docs) update docstrings for `custom_fields()` and
  `custom_field_choices()` methods
* (refactor): use f-strings instead of `.format()` in
  `custom_fields()` and `custom_field_choices()`
* (tests): update naming in tests
* (tests): use `return_value` instead of `side_effect` for mocks
nautics889 added a commit to nautics889/pynautobot that referenced this issue Jul 25, 2023
* (refactor): call `custom_fields()` in `custom_choices()` since they
  represent essentially identical requests to Nautobot
@nautics889 nautics889 mentioned this issue Oct 19, 2023
pszulczewski added a commit that referenced this issue Oct 24, 2023
* fix: Update methods for custom fields (#114)

Add method `custom_field_choices()` in `App` class.
Rename method `custom_choices()` to `custom_fields()`.
Update docstings for both methods according to returning data.

* fix: Tests for methods for custom fields (#114)

Add test case `AppCustomFieldChoicesTestCase` for
`custom_field_choices()` method.
Rename test case for `custom_fields()` method.
Add using fixtures for mentioned test cases.

* fix: Fixtures for tests (custom fields) (#114)

Add missing JSON files with fixtures for tests for getting custom
fields.

* fix: Failing test for getting custom fields (#114)

Fix test cases `AppCustomFieldsTestCase` and
`AppCustomFieldChoicesTestCase` for python 3.7 stable.
Update logic for checking passed arguments of mock's `call_args`.

* Update api.py

* max_workers added

* max_workers added

* Update query.py

* Update query.py

* max_workers from api to request

* debug removed

* Update api.py

* Update query.py

* refactor: Update docstrings and naming (#114)

* (docs) update docstrings for `custom_fields()` and
  `custom_field_choices()` methods
* (refactor): use f-strings instead of `.format()` in
  `custom_fields()` and `custom_field_choices()`
* (tests): update naming in tests
* (tests): use `return_value` instead of `side_effect` for mocks

* fix: backward compatibility

* (fix): restore original method `custom_choices()` for application
  class to provide a compatibility with existing client code
* (enhance): add logging a deprecation warning

* refactor: update `custom_choices()` (#114)

* (refactor): call `custom_fields()` in `custom_choices()` since they
  represent essentially identical requests to Nautobot

* Add version constraint to divide into two release trains 1.x and 2.x (#130)

Add version constraint to divide into two release trains 1.x and 2.x

* Release 2.0 (#136)

* Release 2.0.0

---------

Co-authored-by: Jan Snasel <jan.snasel@networktocode.com>
Co-authored-by: Joe Wesch <10467633+joewesch@users.noreply.github.com>

* Fix SSL verify (#140) (#142)

* Fix custom_fields and custom_field_choices method overlap with endpoints (#141) (#144)

* Release 2.0.1

---------

Co-authored-by: nautics889 <cyberukr@gmail.com>
Co-authored-by: NobodyIsPerfect78 <46317624+NobodyIsPerfect78@users.noreply.github.com>
Co-authored-by: Josh VanDeraa <jv@networktocode.com>
Co-authored-by: Joe Wesch <10467633+joewesch@users.noreply.github.com>
Co-authored-by: Jan Snasel <jan.snasel@networktocode.com>
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 a pull request may close this issue.

1 participant