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 URL generation for relationships nested API #2142

Merged
merged 1 commit into from
Aug 5, 2022

Conversation

glennmatthews
Copy link
Contributor

Closes: DNE

What's Changed

Fix URL generation for nested relationships data in the REST API so that it includes the full path like other url fields.

Before:

            "relationships": {
                "sites-vrfs": {
                    "id": "6736bd25-27cf-4200-a0cf-054eeeb10555",
                    "url": "/api/extras/relationships/6736bd25-27cf-4200-a0cf-054eeeb10555/",   <----<<
                    "name": "Site's VRFs",
                    "type": "many-to-many",
                    "destination": {
                        "label": "Related VRFs",
                        "object_type": "ipam.vrf",
                        "objects": [
                            {
                                "id": "9641b4af-6ab4-4c99-9df2-1e019ed3e546",
                                "url": "http://localhost:8080/api/ipam/vrfs/9641b4af-6ab4-4c99-9df2-1e019ed3e546/",
                                "name": "Red",
                                "rd": null,
                                "display": "Red"
                            }
                        ]
                    }
                }
            }

After:

            "relationships": {
                "sites-vrfs": {
                    "id": "6736bd25-27cf-4200-a0cf-054eeeb10555",
                    "url": "http://localhost:8080/api/extras/relationships/6736bd25-27cf-4200-a0cf-054eeeb10555/",  <------<<
                    "name": "Site's VRFs",
                    "type": "many-to-many",
                    "destination": {
                        "label": "Related VRFs",
                        "object_type": "ipam.vrf",
                        "objects": [
                            {
                                "id": "9641b4af-6ab4-4c99-9df2-1e019ed3e546",
                                "url": "http://localhost:8080/api/ipam/vrfs/9641b4af-6ab4-4c99-9df2-1e019ed3e546/",
                                "name": "Red",
                                "rd": null,
                                "display": "Red"
                            }
                        ]
                    }
                }
            }

@glennmatthews glennmatthews added the type: bug Something isn't working as expected label Aug 4, 2022
@glennmatthews glennmatthews self-assigned this Aug 4, 2022
@glennmatthews glennmatthews merged commit 9f9582c into next Aug 5, 2022
@glennmatthews glennmatthews deleted the gfm-fix-relationships-rest-url branch August 5, 2022 14:38
glennmatthews added a commit that referenced this pull request Aug 5, 2022
smk4664 added a commit to smk4664/nautobot that referenced this pull request Aug 5, 2022
* next:
  Add slug field to CustomField model, add versioned custom-fields REST API, etc. (nautobot#2136)
  Add release-notes for nautobot#2133, nautobot#2137, nautobot#2142
  Fix URL generation for relationships nested API (nautobot#2142)
  Naturalkey docs (nautobot#2138)

# Conflicts:
#	nautobot/core/views/generic.py
smk4664 added a commit to smk4664/nautobot that referenced this pull request Aug 5, 2022
* 'NotesAPI' of github.com:smk4664/nautobot:
  Add slug field to CustomField model, add versioned custom-fields REST API, etc. (nautobot#2136)
  Add release-notes for nautobot#2133, nautobot#2137, nautobot#2142
  Fix URL generation for relationships nested API (nautobot#2142)
  Naturalkey docs (nautobot#2138)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working as expected
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants