postmanlabs / postmanlabs/postman-code-generators

Please allow manual editing and saving to published docs (and avoid code gen from overwriting it)

Open
#156 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

codegen
Dominant language
JavaScript
Stars
1k
Forks
381
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
I am interested in the python code generator.
I would like to edit the code snippet manually myself and totally disable any interference by the auto code generator (that keeps overriding what I have manually copy-pasted in). If there is a way that this can be done, then I would be very keen to know. Thanks

To Reproduce
Body has this raw json:

{
    "outputs": [
        {
            "value": 0,
            "script_pubkey": "6a0548656c6c6f"
        },
        {
            "value": 100,
            "script_pubkey": "76a914fc746b833ca84043e0c7d606de8ecc4b7f3b7cd688ac"
        }
    ],
    "password": "test",
    "utxo_preselection": true
}

Expected code snippet and corresponding request
I want it to look something like this:

import requests

url = "http://127.0.0.1:9999/v1/stn/dapp/wallets/my_wallet.sqlite/1/txs/create_and_broadcast"

payload = { "outputs": [{"value": 0,
                         "script_pubkey": "6a0548656c6c6f"},
                        {"value": 100,
                         "script_pubkey": "76a914fc746b833ca84043e0c7d606de8ecc4b7f3b7cd688ac"}],
            "password": "test",
            "utxo_preselection": True}

headers = {'Content-Type': 'application/json'}

response = requests.request("POST", url, headers=headers, json=payload)

print(response.text.encode('utf8'))

Screenshots
Instead, it looks like this:

import requests

url = "http://127.0.0.1:9999/v1/stn/dapp/wallets/my_wallet.sqlite/1/txs/create_and_broadcast"

payload = "{\n    \"outputs\": [\n        {\n            \"value\": 0,\n            \"script_pubkey\": \"6a0548656c6c6f\"\n        },\n        {\n            \"value\": 100,\n            \"script_pubkey\": \"76a914fc746b833ca84043e0c7d606de8ecc4b7f3b7cd688ac\"\n        }\n    ],\n    \"password\": \"test\",\n    \"utxo_preselection\": true\n}"
headers = {
'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data = payload)

print(response.text.encode('utf8'))

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Python code generator and reproduce the issue using the raw JSON body shown in the report. Verify how manually edited snippets are saved and whether regeneration overwrites them; done means the requested Python formatting is preserved and the generator no longer replaces manual edits.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.